C Board  

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

Reply
 
LinkBack Thread Tools Display Modes
Old 04-03-2007, 10:30 AM   #1
Registered User
 
Join Date: Sep 2004
Posts: 78
FD_SET trouble using winsock.

I find this kind of strange but when I use the FD_SET macro in my program everything compiles fine but when I run the executable it crashes.

Code:
SOCKET test;
fd_set read_check;

FD_SET(test, &read_check);
Any suggestions why this happens ?

EDIT: I'm using the mingw c/c++ compilers and Code::Blocks.
antex is offline   Reply With Quote
Old 04-03-2007, 02:40 PM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,693
Did you initialise the socket variable test?
Did you FD_ZERO the set before using it?
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 04-04-2007, 12:34 AM   #3
Registered User
 
Join Date: Sep 2004
Posts: 78
I thought I did, but when I created a new project just for testing it all worked perfectly. The trouble is in a socket class I'm writing so I have to double check the class code it seems.

If it wasn't for your reply I would not have checked this because I was absolutely sertain I had initialized the socket and also FD_ZERO the set. Thank you!
antex is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Winsock issues tjpanda Windows Programming 3 12-04-2008 08:32 AM
Winsock asynchronous socket + MessageBox() = trouble? jmd15 Networking/Device Communication 8 02-07-2006 02:50 PM
Winsock Messaging Program Morgul Windows Programming 13 04-25-2005 04:00 PM
Where do I initialize Winsock and catch messages for it? Lithorien Windows Programming 10 12-30-2004 12:11 PM
winsock pode Networking/Device Communication 2 09-26-2003 12:45 AM


All times are GMT -6. The time now is 07:40 PM.


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