Hi Earnie!

On Wed, Feb 6, 2013 at 7:32 AM, Earnie Boyd
<[email protected]> wrote:
> On Tue, Feb 5, 2013 at 8:44 PM, K. Frank wrote:
>> Hello List!
>>
>> Not really a pure mingw-w64 question, but maybe someone here knows
>> the answers.
>>
>> Socket connections go two ways -- you can read from and write to them.
>> With a standard windows socket, is it safe to use one thread for reading
>> and another for writing, or are the reading and writing coupled  somehow
>> under the hood?
>
> Does this help any?
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms684841(v=vs.85).aspx

No, it doesn't really.

It was the "Processes and Threads section of 'Dev Center - Desktop":

   Dev Center - Desktop > Docs > Desktop app development documentation
> System Services > Processes and Threads

I clicked around in it some (I didn't read it exhaustively),and didn't
come across any winsock commentary.  (A lot of good stuff on
threads -- I just didn't happen to find the discussion of sockets,
if there is one.)

I did find the following stackexchange topics useful, though:

   http://stackoverflow.com/questions/7418093/use-one-socket-in-two-threads
   
http://stackoverflow.com/questions/1981372/are-parallel-calls-to-send-recv-on-the-same-socket-valid

The consensus seems to be that you can use one thread to read,
and another to write and that "the os will take care of any necessary
synchronization."  There was, however, some equivocation, and no
comments specific to windows nor winsock (and some references
specifically to posix).

I'm going to go with the working assumption that I can use two
threads with a winsock socket, but I'll keep my eyes open, just
in case.

> Earnie


Thanks for your reply.


K. Frank

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to