Declaring a IPAddress as localhost

Posted on 2005-05-09
Last Modified: 2008-03-06
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

Question by:addicktz
    1 Comment
    LVL 1

    Accepted Solution

    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.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now