Declaring a IPAddress as localhost

How do I dim ipa as ipaddress = "" or how do I make an ipendpoint that represents my localhost, port ?

dim tcpl as tcplistener
tcpl = new tcplistener(port) does not work, and is said to be obsolete by 2003

Who is Participating?
There are a number of ways of doin this.

1.) This is one:
         Dim port As Int32 = 13000
         Dim localAddr As IPAddress = IPAddress.Parse("")

         Dim server As New TcpListener(localAddr, port)

2.) This is second:
tcpListener = New TcpListener(CType(Dns.Resolve("machineName").AddressList(0), IPAddress), port)

You can replace "machineName" by "" and vice versa for option one above.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.