flat assembler
Message board for the users of flat assembler.
Index
> Windows > Winsock question |
Author |
|
LocoDelAssembly 09 Sep 2008, 22:40
http://board.flatassembler.net/topic.php?t=9191 Quetannon itself answers that question but there are more non-blocking methods actually. Considering that you want to write a client I think that Quetannon's way is enough for you application though.
Follow all links there. |
|||
09 Sep 2008, 22:40 |
|
f0dder 09 Sep 2008, 23:21
Personally I'm a fan of WSAEventSelect - it scales pretty well if done right (torrent client with thousands of connections and still not too much CPU overhead), it's not overly complicated, and if you want anything but a REALLY simple IRC cilent, you will need multiple connections anyway (multi-server, DCC, ...)
The trick with WSAEventSelect is to create N events, and have an array of N linked lists (or whatever) with connection information. You can then use WaitForMultipleObjectSex to wait for one of those N events, a termination event (keep N one below MAXIMUM_WAIT_OBJECTS), or a timeout. If you get between WAIT_OBJECT_0 and WAIT_OBJECT_0+N-1, you traverse the corresponding array-entry list and process all the list entries, calling WSAEnumNetworkEvents on the network socket to determine if the socket has activity. It might seem wasteful polling all sockets in the list for activity, but remember you only get an event when at least one socket has data, and you're partitioning your sockets into N lists. It works well in practice, is somewhat less work than a full IOCP implementation, and iirc also works on Win9x which IOCP doesn't. |
|||
09 Sep 2008, 23:21 |
|
OzzY 16 Sep 2008, 23:56
I've read the Quetannon example and still couldn't understand WSAAsyncSelect, but when I read this tutorial http://johnnie.jerrata.com/winsocktutorial/ everything was clear.
And now I understand the Quetannon example. WSAAsyncSelect seems to be very handy. I still need to write my own code and test it. But it looks like what I was looking for. Thanks guys. |
|||
16 Sep 2008, 23:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.