How to get CAsyncSocket sending datagrams to another app on the same computer
Posted on 2010-01-02
Hello, little embarrassed I can't get this to work, but we are playing around with windows sockets, ASyncSocket, and we think we want the UDP datagram mode. We want to play around with a couple of application-level approaches, and want to start up a couple of applications on the same computer (for convenience) that talk via sockets.
Anyway, I can't seem to get the right order of socket functions to make this work, here's what I do:
instantiate an AsyncSocket (well, my class derived from it)
call Create(1000, SOCK_DGRAM)
call Connect("127.0.0.1", 1000)
call Send("abc", 3, 0) (this seems to work, in fact it triggers its own OnReceive)
can't even create a socket on the same port 1000
So how do I hear datagrams sent by application 1 with application 2? Is it possible?
The MSDN documentation is not great on this topic, in fact in a few places it seems to be talking only about streaming connections, not datagrams.
Any help is very appreciated, thanks.