How do I use the IPEndPoint?

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
 
D

Dominique Vandensteen

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)
 
B

BadOmen

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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top