How do I use the IPEndPoint?

  • Thread starter Thread starter BadOmen
  • Start date Start date
B

BadOmen

Hi,
This is used in a FAQ and it works fine wile connecting to my computer but I
want to connect to an other...

Original code:

Code:

Private _IpEndPoint As New
IPEndPoint(Dns.GetHostByName(Dns.GetHostName).AddressList(0), 5124)



I have tried to do it like this:

Code:

Private _IpEndPoint As New IPEndPoint("xxx.xx.xx.xxx",6666)



where the x stands for a IP number... But that will not work...

It generates an error here(In the FAQ winsock code):

Code:

' Call the Socket Connection method passing it the IP
' address and port of this computer (_IpEndPoint)
' This establish the Sockets connection to a remote device.

_ClientSocket.Connect(_IpEndPoint) '***This don't work when I use an IP
instead of the Dns...

The ERROR message:

An unhandled exception of type 'System.Net.Sockets.SocketException' occurred
in system.dll
Additional information: To many references to some kernel-object


Yours, Jonas
 
can you pass a string in the constructor of IPEndPoint?
strange, I can't...

try this

Dim _ipEndPoint As New IPEndPoint(IPAddress.Parse("172.16.1.1"), 12345)
 
Dominique Vandensteen said:
can you pass a string in the constructor of IPEndPoint?
strange, I can't...

No, I can't... Like I sad "How do I use the IPEndPoint" :-P
try this

Dim _ipEndPoint As New IPEndPoint(IPAddress.Parse("172.16.1.1"), 12345)
Thanx, I will use that one :-)
 
Back
Top