Strange IP address format?

bonedoc

Well-known member
Joined
May 4, 2006
Messages
112
Programming Experience
Beginner
I am using:

VB.NET:
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
lblIP.Text = h.AddressList.GetValue(0).ToString

to get my IP address. I am getting this format returned:

2002:450d:a56c::450d:a56c

I guess this is IPv6 format? I am doing some TCP stuff, and every time I try to connect, I get the error "no such host known". Is there a way to connect differently with this format or convert it? What is strange is when I go to canyouseeme.org, it gives me a normal address. Sorry..I am in the wrong forum as usually..

Here is how I get the address:

VB.NET:
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
Dim address1 as string = h.AddressList.GetValue(0).ToString())
Here is how I am trying to connect:
Dim tcp As New TcpClient
tcp.Connect(address1, 800)
Is there a way to connect to an IP by its website or DNS name?
 
Last edited by a moderator:
One of the overloads for the Connect() function takes the dns name for the host you want to connect to:

VB.NET:
Dim t As New TcpClient()
t.Connect("www.yahoo.com", 9999)
 
You can try the IPAddress.Parse() method.? This method will return an IPAddress object.
I don't know if it supports IPv6, but you can try.
Try:

t.Connect(IPAddress.Parse("ipv6 address string"), port)
 
IPAddress.Parse supports IPv6 format the documentation states.
 
IPAddress.Parse supports IPv6 format the documentation states.

Ok, so I am doing the IPAddress.Parse(IPAddress)

Now, I get the error:

"An address incompatable with the requested protocol used"

So, I tried doing:

Dim tcp as New TCPClient(System.Net.Sockets.AddressFamily.InterNetworkV6)

But I get the same thing. What could I be doing wrong? When my computer accepts a connection with a tcpListener, is there a way to get the requesters IP and/or Address type?
 
Either your machine, or the remote machine has a firewall that is denying the conenction, or the service/tcp stack of the machine has been instructed to deny your connection (or maybe a range of conenctions you fall into)
 
Back
Top