AFAICWO: Because I'm using accept()
to listening for a TCP socket connection request, what accept returns me is a connection-oriented socket. So I have to use WSASend()
instead of WSASendMsg()
. MSDN docs do have this tidbit which eventually tipped me off to where I was going wrong:
The WSASendMsg function can only be used with datagrams and raw sockets.
In other words, WSASendMsg()
is ONLY intended for use in connectionless scenarios like UDP, ICMP, or any other raw sockets where you are authoring your own packets.
(Probably, I could also have used WSASendTo()
instead:)
On a connection-oriented socket, the lpTo and iToLen parameters are ignored; in this case, the WSASendTo is equivalent to WSASend.