http://www.nomorepasting.com/paste.php?pasteID=3846
select is allways returning SOCKET_ERROR, and then WSAGetLastError returns WSAENOTSOCK.
What am I doing wrong?
Wehhhhhhhhhhooooooooo!!!!!!!
90 nfds=ListeningSocket+1;
91 s = select(nfds, &conn, NULL, NULL, &timeout);
You had an errors at line 90.
nfds means that numbers of current selecting sockets + 1, so this value was set to 2.
ListeningSocket was socket descriptor value, no numbers of listeningsocket.
And notice follow.
One of the descriptor sets[&conn] contains an entry, that is not a socket.
For reason, select will returns SOCKET_ERROR, and WSAGetLastError returns WSAENOTSOCK.
As your codes, conn structures contains only listening socket information, then numbers of descriptor was 1 and nfds was must set to 2.
But nfds was ListenningSocket Descriptor value[maybe more over than 1, suppose this was 4] +1, so behind three descriptor information was gabage.
Forbidden my English, I am Korean.
[edited by - veruna2k on May 25, 2003 11:46:02 PM]
[edited by - veruna2k on May 26, 2003 1:56:39 AM]
[edited by - veruna2k on May 26, 2003 1:57:37 AM]
[edited by - veruna2k on May 26, 2003 1:59:08 AM]
[edited by - veruna2k on May 26, 2003 2:00:33 AM]
91 s = select(nfds, &conn, NULL, NULL, &timeout);
You had an errors at line 90.
nfds means that numbers of current selecting sockets + 1, so this value was set to 2.
ListeningSocket was socket descriptor value, no numbers of listeningsocket.
And notice follow.
One of the descriptor sets[&conn] contains an entry, that is not a socket.
For reason, select will returns SOCKET_ERROR, and WSAGetLastError returns WSAENOTSOCK.
As your codes, conn structures contains only listening socket information, then numbers of descriptor was 1 and nfds was must set to 2.
But nfds was ListenningSocket Descriptor value[maybe more over than 1, suppose this was 4] +1, so behind three descriptor information was gabage.
Forbidden my English, I am Korean.
[edited by - veruna2k on May 25, 2003 11:46:02 PM]
[edited by - veruna2k on May 26, 2003 1:56:39 AM]
[edited by - veruna2k on May 26, 2003 1:57:37 AM]
[edited by - veruna2k on May 26, 2003 1:59:08 AM]
[edited by - veruna2k on May 26, 2003 2:00:33 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement