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:
and my fd_set is as follows:Code:timeval SecTime={0,0};
and set with:Code:static fd_set ReadFDs, WriteFDs, ExceptFDs;
select call is:Code:FD_ZERO(&ReadFDs); FD_ZERO(&WriteFDs); FD_ZERO(&ExceptFDs); FD_SET (sock, &ReadFDs); FD_SET (sock, &ExceptFDs);
A zip file with all source code and exe is attached. anyhelp would be great. ThanksCode:if ( select (0, &ReadFDs, &WriteFDs, &ExceptFDs, &SecTime) == SOCKET_ERROR)



LinkBack URL
About LinkBacks


