hi all,
I am trying to make a small server, using event mode.

here is the snippet code:

invoke bind, hListenSocket, addr SA_IN, sizeof sockaddr_in
invoke WSACreateEvent
mov hListenEvent, eax
invoke WSAEventSelect, hListenSocket, hListenEvent, FD_ACCEPT+FD_CLOSE
invoke listen, hListenSocket, 5

@CheckSignalAgain:
invoke WSAWaitForMultipleEvents, 1, addr hListenEvent, FALSE, INFINITE, FALSE
invoke WSAEnumNetworkEvents, hListenSocket, hListenEvent, addr WSAEventListen
test WSAEventListen.lNetworkEvents, FD_ACCEPT
jz @CheckServerClose
;do accept
@CheckServerClose:
test WSAEventListen.lNetworkEvents, FD_CLOSE
jz @CheckSignalAgain
;do close <--- this signal never get called
:confused:
any Idea?????


what I want to do is to check the server got the close signal or not, if close signal on, I send a msg to the main window saying the server is close....
Posted on 2003-03-03 15:12:28 by Yanda
And what would cause the close event on the server :confused: ?

There's no such thing for a listening socket. There is for a client<->server connection because the other side can close the connection. But noone but yourself can close the listening socket. There's no connection on the listening socket, it is just listening. If you want to stop the server, stop waiting for events and shutdown the listening socket.

Thomas
Posted on 2003-03-03 15:19:37 by Thomas
doh!:eek:
forgot about that....

thankx thomas.
Posted on 2003-03-03 16:58:18 by Yanda