are winsock functions thread safe?

This is a discussion on are winsock functions thread safe? within the Networking/Device Communication forums, part of the General Programming Boards category; Hi, i have a server which randomly crashes on occasion and im trying to hunt down the problem. Im just ...

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    63

    are winsock functions thread safe?

    Hi, i have a server which randomly crashes on occasion and im trying to hunt down the problem. Im just wonder, are winsock functions thread safe? i should point out im using winsock 1.1

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,652
    What do you mean? Are you using the same socket in multiple threads?

    gg

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    If you are using blocking sockets then not really. The blocking socket will sit there until something happens which is never good for a thread.

    But besides that yes sockets are safe. I've got a server running in a thread which then fires off more threads to serve the connections and it works just fine. I would not recommend attempting to share a socket acrossed a thread though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C thread functions?
    By audinue in forum C Programming
    Replies: 3
    Last Post: 07-08-2008, 07:47 AM
  2. Where do I initialize Winsock and catch messages for it?
    By Lithorien in forum Windows Programming
    Replies: 10
    Last Post: 12-30-2004, 11:11 AM
  3. Win32 Thread Object Model Revisted
    By Codeplug in forum Windows Programming
    Replies: 5
    Last Post: 12-15-2004, 07:50 AM
  4. Replies: 12
    Last Post: 05-17-2003, 05:58 AM
  5. API "Clean Up" Functions & delete Pointers :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-10-2002, 06:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21