[haiku-development] Re: server connection

  • From: "Clemens Zeidler" <clemens.zeidler@xxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 24 Nov 2010 09:08:55 +1300

Am 24.11.2010, 08:49 Uhr, schrieb Rene Gollent <anevilyak@xxxxxxxxx>:

On Tue, Nov 23, 2010 at 2:43 PM, Clemens Zeidler
<clemens.zeidler@xxxxxxxxxxxxxx> wrote:

whats happen if there are 3 bytes in the queue and I try to read 4 will recv
return earlier?
anyway thanks to both of you for all the input will try it out now :-)


recv() returns the number of bytes actually read, the passed in buffer
only limits the upper bound of how much it will read. If 3 bytes are
what's available when you call recv(), it will return immediately
having given you those 3 bytes. It only blocks if no data is currently
available at all (and the socket isn't in non-blocking mode)

I'm unsure about this too can I write to the same socket id (from a second thread) while a recv is blocking? or do I have to create a second socket? if
yes how?, can I clone it somehow?

Writing to the same socket from multiple threads is perfectly valid,
as with any other file descriptor.


perfect! now I can start :-)

thanks
        Clemens

Other related posts: