1

Ok, I am trying to use the System.Net.Sockets part of the .Net Framework 4 to connect to an IPEndPoint.

First I declare the IP address as a variable like so

IPAddress myIpAddress = IPAddress.Parse("10.10.15.200");

Then I declare my IP endpoint as a variable like so:

IPEndPoint ip = new IPEndPoint(myIpAddress, 5001);

Then I try and bind to this socket, like so:

socket.Bind(ip);

The response I get is as follows:

The requested address is not valid in its context.

However this is not the case. The IP address exists and is currently active. The IP address in question is a VOIP phone on a SIP trunk.

Thanks in advance.

John

JMK
  • 27,273
  • 52
  • 163
  • 280

1 Answers1

1

Bind is used to associate to a local address and port and is where the packets will be marked as coming from. You need to use Connect instead.

Adam Robinson
  • 182,639
  • 35
  • 285
  • 343