0
Answer

Socket.Bind: Exception on PC's with different IP-Addresses.

uwe.kl

uwe.kl

20y
1.9k
1
Hi, I have the following problem. I hope that this is the right section to post it. I need to create a udp socket and i do it the following way. Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint ipep = new IPEndPoint(IPAddress.Any,11000); socket.Bind(ipep); Everything works fine when I compile the program. Even the compiled EXE runs on the PC it was compiled on. But when I move the EXE to another machine, I get a exception. When I change the IPAddress to the address of the machine the EXE was compiled on, everything works fine again. For now I help myself with a config file and code like this: (the ip is from the config file). IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("192.168.9.3",11000); socket.Bind(ipep); So, what happend? Is the IPAddress.Any statical binded during the compilation, do I have to set some compiler switches? I tried the same with an TCP-Connection (async and non async). The result was the same. Thanks in advance, Uwe.