Saiful Khan wrote:
> Hello,
> 
> I observed some thing really surprised me-
> if i put a 10000 microsecond sleep between consecutive sendto() then
> it sends any no of packets packets continuously.
> 
> while (test_time <=180000.0) //Test duration, In  millisecond
> {
>     bzero (buffer, 50);
>     strcpy(buffer, "hello server - xenomai");
>     n = sendto (sockfd, buffer, 50, 0, (struct sockaddr *) &serv_addr,
> (socklen_t) sizeof (serv_addr));
>     usleep (10000);   
>     if ( n < 0 )
>     {
>         perror ("ERROR, Sending Failed....\n");
>         exit (0);
>     }
> }//end of while
> 
> --but if i dont give the usleep(), it sends only 16 packets. More over
> if I use usleep(1000), then also after sending some messages the
> program exits giving "ERROR, Sending Failed.... No buffer space
> available".

OK, a few things to note:

 - sendto is non-blocking, i.e. it tries to send immediately, queues
   messages that cannot be sent right now (TDMA...), fails if something
   goes wrong before enqueuing (routing, no more buffers, ...).

 - You are running RTmac/TDMA, likely with the default setup: 1 message
   slot per node each 5 ms.

 - You try to send messages at a higher rate, consuming your personal
   (per socket) transmission buffers faster than they can be released
   again (after the actual transmission). Thus, your system setup is
   broken. Either fix your application or the TDMA network
   configuration.

 - usleep is, according to POSIX spec, obsolescent. More problematic: it
   is not supported by Xenomai's POSIX skin, thus you are continuously
   leaving the RT context to sleep for an indeterministic period. Use
   [clock_]nanosleep instead. (That's just a footnote here, not the
   reason for the error message.)

HTH,
Jan

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to