Re: is sendto and recvfrom thread safe?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 21 Aug 2003 15:02:26 -0500
"Lee Chin" <leechin@mail.com> wrote:

> This sort  of helps... my question is with respect to UDP sockets, for sendto and recvfrom, can I concurrently have two threads at the same time write (sendto) on a same file descriptor?  How about readfrom and sendt on the same file descriptor at the same time?

Yes, but assume two threads A (writes a one message containing "aaaa") 
and B which (writes two messages "b" and "c").

You can be assured that B's data won't show up inside A's message:
	ie. never aabaa
but you can not assume anything about the order they will be received.

If you want more detail read the book.
 W. Richard Stevens, UNIX network programming, Volume 1

http://www.kohala.com/start/
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux