IP addresses

  • Thread starter Thread starter bernardpace
  • Start date Start date
B

bernardpace

Hi,

I am trying to create an IPAddress and pass it to the IPEndPoint
constructor.

IPAddress ipAddress = IPAddress.Parse("127.0.0.1");
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, portNo);

When running that code the following error is being given on the 2nd
line:
"An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in system.dll

Additional information: Specified argument was out of the range of
valid values."

Can someone help me out
Thanks in Advance
 
IPAddress ipAddress = IPAddress.Parse("127.0.0.1");
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, portNo);

What is portNo set to? Did you possibly forget to initialize it to your
desired port number?
 
Yes, infact it was a problem of port number. The port number that I
was passing was larger than the range expected.

Thanks for your help
 
Back
Top