Does anyone have a example of a simple send/receive of data using Winsock. I seem to be able to send the data out, but receiving it appears to be giving me a lot of problems. I am basically wanting to send out a packet of data that a server on the other end is going to respond to with a packet, and put the responce into a buffer. I believe I am actually having trouble with WSAAsyncSelect, but I am not for sure, I am just looking for a non-macroed simple as pie example I can look at to see how winsock handles this stuff. I can understand BSD sockets a LOT better than this stuff....almost makes me wanna move back to FreeBSD....:)
Thanks
Cheeseball
Posted on 2002-02-18 16:56:19 by Cheeseball
If you want to use MASM32 then look at this:
http://spiff.tripnet.se/~iczelion/asmsockguide.html

Or if you want to use C, then this is good:
http://tangentsoft.net/wskfaq/
Posted on 2002-02-18 18:24:19 by NoException
of course you can get alot more fancy than this but this is kinda the basic:

.const

event equ 4001 ;// <-- you need make a special message that you respond to when you get an FD_READ etc

.code
invoke WSAAsyncSelect,hSocket0,hGlobal, Event, FD_READ+FD_WRITE+FD_CLOSE+FD_CONNECT

....
......
.......


.elseif uMsg == event ;// <-- your special event notifying you
mov eax, lParam
.if ax==FD_READ
invoke recv, hSocket, pIncomingData,sizeof pIncomingData, 0
Posted on 2002-02-18 23:10:27 by smurf