I'm trying to write a simple server and client app to learn WinSocks. I'm using a windows app.
Server:
3 buttons and edit box. 1 button calls WSAStartup and sets stuff up. Another starts the socket and calls listen(). 3rd stops the sockets and calls WSACleanup.
Client.
3 buttons and edit box. 1 button calls WSAStartup and sets stuff up. 2nd Starts socket and connect. 3rd stops the sockets and calls WSACleanup.
Client seems to be working so far.
Problem is with the server. I'm using a Timer to call select() to see if there is anything there. When I call select I'm getting an error of WSAEINVAL. My timeval is declared as following:
Code:
timeval SecTime={0,0};
and my fd_set is as follows:
Code:
static fd_set ReadFDs, WriteFDs, ExceptFDs;
and set with:
Code:
FD_ZERO(&ReadFDs);
FD_ZERO(&WriteFDs);
FD_ZERO(&ExceptFDs);
FD_SET (sock, &ReadFDs);
FD_SET (sock, &ExceptFDs);
select call is:
Code:
if ( select (0, &ReadFDs, &WriteFDs, &ExceptFDs, &SecTime) == SOCKET_ERROR)
A zip file with all source code and exe is attached. anyhelp would be great. Thanks