I'm forwarding my answer to Prakash to the mailing list, in case anyone
needs in the future.

Leandro Favarin

---------- Forwarded message ----------
From: Leandro Favarin <leandro.fava...@phiinnovations.com>
Date: Tue, Jul 27, 2010 at 12:49 PM
Subject: Re: Re: [RTnet-users] rt_dev_recvfrom returns -1 in my sockets
program
To: prakash srinivasan <asprakash...@rediffmail.com>


Hi Prakash,
Unfortunately I don't have then anymore (I was testing in these examples to
adapt to my code) but I can try to help you.
>From what I understood, the idea is that you have to put the functions
rt_dev_sendto() and rt_dev_recvfrom() inside RT tasks. Here is part of my
main():

void main(void) {
 ...
 signal(SIGTERM, catch_signal);
 signal(SIGINT, catch_signal);
 signal(SIGHUP, catch_signal);
 mlockall(MCL_CURRENT|MCL_FUTURE);

 rt_task_create(&rt_server_task, "Server", 0, 10, 0);
 rt_task_start(&rt_server_task, server_msg, NULL);
 ...
}

outside of the functions, you will need to add:
RT_TASK rt_server_task;

and the rt_server_task itself:

void server_msg(void *arg) {
 ...
 while (1) {
  rt_dev_recvfrom(...) ;
  ...
 }
}

OBS: Don't forget to add the task_delete in the end:
rt_task_delete(&rt_server_task);

OBS2: Look at docs for rt_task_set_periodic() and rt_task_wait_period() as
well.

Good luck!
Leandro Favarin



On Tue, Jul 27, 2010 at 12:21 PM, prakash srinivasan <
asprakash...@rediffmail.com> wrote:

>
> Dear Leandro Favarin,
> I am also trying the same way. But I just tried to convert linux_server.c
> into real time server application and I just used the same code
> linux_clinet.c on client side. But Its not working properly. The server is
> waiting for while.
> Can you share your modified linux_server.c and linux_clinet.c files with
> me?. I hope it can surely helpful for me understand the real time socket
> programming.
>
> Thanks in adv,
> Prakash.
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to