Reputation: 27723
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
Upvotes: 0
Views: 929
Reputation: 19230
The issue is you are using the code for the sample unmodified.
This is trying to connect to AlternateHostMachineName
which does not exist, and therefore throws a 0x80004005: No such host is known
exception.
You need to amend the code to connect to a real server.
Upvotes: 2
Reputation: 70379
The reason is that you are refering to hostnames that can't be resolved and/or your network settings (esp. DNS) are are somehow wrong...
The example you refer to contains two hostnames www.contoso.com
and AlternateHostMachineName
- both are not resolvable since they don't exist... you need to replace them with real hostnames or IP adresses and make sure that your DNS settings are correct/working...
Upvotes: 1