flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > c win question, can someone help me with IOCP worker thread |
Author |
|
typedef 31 Dec 2011, 20:39
The threading part is for console apps I suppose. But if you go back to quetannon, you'll find that it's using the WSAAsyncSelect API for a non blocking style socket. Your app must be processing window messages in order to receive socket notifications.
You must register for the specific notifications you wish to receive, I.e when connected or received some bytes. So after you receive the bytes you check the length as you mentioned and then continue to parse the HTTP headers and construct a response afterwards. There's a trick of converting a socket handle to a FILE handle using fdopen but I don't recommend it. |
|||
31 Dec 2011, 20:39 |
|
sleepsleep 01 Jan 2012, 04:44
found out google chrome opens up 2 sockets in each visit.
Code: 2012-01-01 12:27:49 (453) 1912 -accepted 2012-01-01 12:27:49 (468) socket (1912) transmitted : 392 bytes 2012-01-01 12:27:49 (468) 1888 -accepted 2012-01-01 12:28:01 (109) 1888 -closing fromserver[0], toserver[0] the first (1912) transmit 392 bytes HTTP get request, then another socket which transmit nothing. after around 11 seconds then auto close. maybe some internal API, handshake is expected? websocket? idk. typedef, thanks, but ma stuck with this iocp, will still try to make it functions, hopefully. |
|||
01 Jan 2012, 04:44 |
|
sleepsleep 01 Jan 2012, 15:56
wanna ask,
after we WSASend ""Connection: close\r\n\r\n" to connected browser client, the connection will get "disconnected" by browser. but the server get no notification about this "disconnection", how to get such notification? because btrans == 0 doesn't work when browser disconnects on their own. |
|||
01 Jan 2012, 15:56 |
|
typedef 01 Jan 2012, 17:11
You have to actually close the connection to the server. That Header command just tells the server not to use a persistent connection.
|
|||
01 Jan 2012, 17:11 |
|
sleepsleep 01 Jan 2012, 21:04
thanks,
finally, ma sort of figure out how the whole shit running need to use DisconnectEx to close the socket after send out Connection: close, so the pending overlapped IO will exit gracefully. damn it, it tooks hours!!, maybe years since i first interested to build my own http iocp web server. |
|||
01 Jan 2012, 21:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.