I’m trying to get two instances of my program to communicate between them. I’ve been referred to udp, and so I’m trying to run the example from here: http://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient%28v=VS.100%29.aspx
But I get an error:
“socketexception (0x80004005): This is usually a temporary error during hostname resolution…”
how do I solve this?
I don’t know anything about this stuff. I googled for what I needed and found this here:
//This is how you do it (kudos to sipwiz)
UdpClient udpServer = new UdpClient(localpt); //This is what the proprietary(see question) sender would do (nothing special)
//!!! The following 3 lines is what the poster needs...(and the definition of localpt (of course))
UdpClient udpServer2 = new UdpClient();
udpServer2.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
udpServer2.Client.Bind(localpt);
Thanks
The issue is you are using the code for the sample unmodified.
This is trying to connect to
AlternateHostMachineNamewhich does not exist, and therefore throws a0x80004005: No such host is knownexception.You need to amend the code to connect to a real server.