problem with dynamic ips when using sockets.
-
i'm developing a simple socket application for server client architecture. it works fine when the pc is having a static it , but when the pc is obtaining Ips automatically means when the radio button for "obtain an ip autmatically" , it gives the exception saying this ip is not valid in the context , any idea to address this situation. thanx in advance.
-
i'm developing a simple socket application for server client architecture. it works fine when the pc is having a static it , but when the pc is obtaining Ips automatically means when the radio button for "obtain an ip autmatically" , it gives the exception saying this ip is not valid in the context , any idea to address this situation. thanx in advance.
Can you use machine name instead of IP address. As you indicated the IP address can be changed when it is using dynamic IP setting, where as the machine name stays the same.
Yusuf May I help you?
-
i'm developing a simple socket application for server client architecture. it works fine when the pc is having a static it , but when the pc is obtaining Ips automatically means when the radio button for "obtain an ip autmatically" , it gives the exception saying this ip is not valid in the context , any idea to address this situation. thanx in advance.
Which IP address are you referring to here, the local or remote? If it is the remote address then you need to verify that it is consistent with the actual address in use by the remote machine. Perhaps if you show an extract of your code, and what results you are seeing, we can offer some further suggestions.
I must get a clever new signature for 2011.
-
i'm developing a simple socket application for server client architecture. it works fine when the pc is having a static it , but when the pc is obtaining Ips automatically means when the radio button for "obtain an ip autmatically" , it gives the exception saying this ip is not valid in the context , any idea to address this situation. thanx in advance.
In a client server architecture the 'server' IP is traditionally fixed. Not dynamic. In a client server architecture the client connects to the server. If the server IP is not fixed then one must use another mechanism which will require some other server to get the current IP. Host name resolution is one method to do that. It does however require that the host name is being managed by a DNS server.
-
Which IP address are you referring to here, the local or remote? If it is the remote address then you need to verify that it is consistent with the actual address in use by the remote machine. Perhaps if you show an extract of your code, and what results you are seeing, we can offer some further suggestions.
I must get a clever new signature for 2011.
thanx for all of you ..! and this is the code segment i use.
localIP = Dns.GetHostAddresses(Dns.GetHostName())\[0\]; IPEndPoint localEndpoint = new IPEndPoint(localIP, 7575); lSoc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); lSoc.Bind(localEndpoint); lSoc.Listen(10);
-
thanx for all of you ..! and this is the code segment i use.
localIP = Dns.GetHostAddresses(Dns.GetHostName())\[0\]; IPEndPoint localEndpoint = new IPEndPoint(localIP, 7575); lSoc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); lSoc.Bind(localEndpoint); lSoc.Listen(10);