Re: Multithread safety

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

  • Writing to file delay
    ... I am reading a file on one machine that is continuosly being written to ... socket and writing it to a file. ... file.write buff ...
    (comp.lang.ruby)
  • Re: Writing to file delay
    ... I am reading a file on one machine that is continuosly being written to ... socket and writing it to a file. ... Since you're on Linux, try stracing both the Ruby process and your tail ...
    (comp.lang.ruby)
  • 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: Writing to file delay
    ... I am reading a file on one machine that is continuosly being written to ... socket and writing it to a file. ... NotImplementedError is raised if the underlying operating system does ...
    (comp.lang.ruby)
  • 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)