C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 12-15-2007, 08:11 AM   #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
*DEAD* is offline   Reply With Quote
Old 12-15-2007, 08:41 AM   #2
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,894
What do you mean? Are you using the same socket in multiple threads?

gg
Codeplug is offline   Reply With Quote
Old 12-15-2007, 10:37 AM   #3
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,811
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.
Bubba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C thread functions? audinue C Programming 3 07-08-2008 07:47 AM
Where do I initialize Winsock and catch messages for it? Lithorien Windows Programming 10 12-30-2004 12:11 PM
Win32 Thread Object Model Revisted Codeplug Windows Programming 5 12-15-2004 08:50 AM
injecting my own thread into the address space of another process - cannot call any f Andrew_5342 Windows Programming 12 05-17-2003 05:58 AM
API "Clean Up" Functions & delete Pointers :: Winsock kuphryn Windows Programming 2 05-10-2002 06:53 PM


All times are GMT -6. The time now is 09:14 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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