Re: Multithread safety



Mike Gleason Jr Couturier wrote:
> What I meant to say is : If one thread is writing to
> the socket while another one is reading to it (full-duplex),
> its impossible in certain cases for the writing thread to
> be notified in time by the reading thread that the socket
> has been closed by the peer... So how can I write
> full-duplex production code?

I am not sure what exactly you mean by full-duplex in this context so I'll
assume that you want to read and write simultaneously rather than in
request-response fashion. In this case you need to break the BSD barrier and
use asynchronous I/O offered by Winsock. Unless you need full Unix
compatibility (and even then) it rarely makes sense to limit yourself to
BSD-style sockets only. They were invented in a different world with
different performance characteristics and application architectures than the
one you develop for.

--
Eugene
http://www.gershnik.com



.



Relevant Pages

  • Re: Suggestions for reading binary data from a connected socket.
    ... >to find an example explaining the best solution for reading and writing a ... >message from a socket. ...
    (comp.lang.java.programmer)
  • Re: Multithread safety
    ... What I meant to say is: If one thread is writing to ... the socket while another one is reading to it (full-duplex), ...
    (microsoft.public.win32.programmer.networks)
  • Re: Sharing the socket between 2 threads
    ... My plan is to use 2 threads: main for writing and slave for background ... reading. ... how to share the socket between 2 threads? ...
    (comp.lang.tcl)
  • Re: How do I know ECONNREFUSED from non-blocking connect?
    ... > before the socket is reported as writable. ... Before the socket reports ... > don't go reading or writing if you really want to know what the ... I am actually writing a higher-level library! ...
    (comp.unix.programmer)
  • Re: Socket recv() question?
    ... You might be doing something crazy, writing the data to the file one byte at ... socket function correctly? ... How come when I use the IE on the Pocket PC and started IIS on my PC. ... Configure tx timeout ...
    (microsoft.public.windowsce.app.development)