When I execute this non-gui non-console prog a sandclock appears like for 10 seconds, so there must be something wrong with the code, right ?



..
.repeat
invoke BlockingServerProc, Server
.until (TerminateProgram == 1)
..




BlockingServerProc proc aServer:DWORD
LOCAL Console:DWORD, Dummy:DWORD

invoke accept, aServer, 0, 0
mov Console, eax
.if Console != INVALID_SOCKET
invoke CreateThread, 0, 65536, offset ThreadProc, Console, 0, addr Dummy
mov hThreadId, eax
.if (!eax)
invoke TerminateThread, hThreadId, 0
invoke ShutSocket, Console
.endif
.endif
ret
BlockingServerProc endp




ThreadProc proc lParam:DWORD
LOCAL ChildSocket:DWORD, Status:DWORD
LOCAL szBuffer[256]:BYTE
LOCAL szCmd[4]:BYTE

mov eax, lParam
mov ChildSocket, eax

.repeat
invoke RtlZeroMemory, addr szBuffer, sizeof szBuffer
invoke recv, ChildSocket, addr szBuffer, sizeof szBuffer, 0
mov Status, eax
.if Status == 0
mov Status, SOCKET_ERROR
.else
invoke lstrcmpi, addr szBuffer, offset szFinishProgram
.if eax == 0
mov TerminateProgram, 1
invoke ShutSocket, ChildSocket
invoke ShutSocket, Server
ret
.endif
invoke send, ChildSocket, addr szBuffer, sizeof szBuffer, 0
.endif
.until (Status == SOCKET_ERROR)

invoke ShutSocket, ChildSocket
ret
ThreadProc endp
Posted on 2003-08-29 18:02:59 by Jnrz
someone knows ?
Posted on 2003-09-02 19:41:30 by Jnrz