views:

58

answers:

1

I remember having read somewhere that a socket can be regarded as two independent half-duplex channels. Does it mean that recv() and send() of the same socket are actually irrelevant?

  • if so, is it by definition or implementation-specific?
  • if not, how the two interfere with each other?

thanks.

+1  A: 

I'm curious how you think they would interfere with each other. Are you thinking that you might receive what you sent?

Blank Xavier
No, I means how one can influence the correctness or efficiency of behavior of the other, if they do. For example, if they share the same buffer, it's very likely one must wait until the other is idle, right?
t.g.
You can issue blocking or non-blocking sends and recieves. With blocking, the data buffer you pass in IS the data buffer. No chance of confusion. With non-blocking, your data buffer is copied. There are no restrictions in the API documentation regarding interleaved use, so they must be using different buffers; for if they were not, they could not be non-blocking (they would have to block on each other).
Blank Xavier