flat assembler
Message board for the users of flat assembler.

Index > Windows > WSAAsyncSelect - can anyone please explain?

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
Hello!
I've been reading the Quenatton example, for better understanding Winsock programming with FASM.
I can't understand WSAAsyncSelect. Can anyone post some explanation?
What it really does? When should I use it?

Thanks
Post 21 Aug 2007, 17:12
View user's profile Send private message Reply with quote
xspeed



Joined: 16 Aug 2007
Posts: 22
xspeed
you should just go to msdn

WSAAsyncSelect=request event notification for a socket. Used to prevent network flooding on the same socket.

int WSAAsyncSelect(SOCKET s,HWND hWnd,unsigned int wMsg,long lEvent); msdn


1. data arrives on socket s; Windows Sockets posts WSAAsyncSelect message

2. application processes some other message

3. while processing, application issues an ioctlsocket(s, FIONREAD...) and notices that there is data ready to be read

4. application issues a recv(s,...) to read the data

5. application loops to process next message, eventually reaching the WSAAsyncSelect message indicating that data is ready to read

6. application issues recv(s,...), which fails with the error WSAEWOULDBLOCK.

* Issuing WSAAsyncSelect after one another cancel out the previous order.

s1 = WSAAsyncSelect(s, hWnd, Msg1, megetkill);
s1 = WSAAsyncSelect(s, hWnd, Msg2, ikillhim);


megetkill/ikillhim=FD_READ,FD_WRITE,FD_OOB,FD_ACCEPT,FD_CONNECT NONE ,FD_CLOSE NONE.
Post 23 Aug 2007, 16:26
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
You shouldn't bother with WSAAsyncSelect, even blocking sockets + threads are better imho... look at WSAEventSelect or I/O Completion Ports instead.
Post 26 Aug 2007, 16:35
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
if you only have few concurrent connections, threads should be easier to do
Post 27 Aug 2007, 08:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.