Argument for Constructor to Return Client IP Address with VB.net

Posted on 2008-02-07
Medium Priority
Last Modified: 2013-11-26
I found many questions on how to get the client IP with VB.net. The questions pointed to this Article.  "http://www.codeproject.com/KB/IP/VBTcpClientIPAddress.aspx" I need help figuring out what to send for "client" in the constructor. Thanks  John
Question by:just_joe_
  • 2
  • 2
LVL 64

Accepted Solution

Fernando Soto earned 2000 total points
ID: 20850388
Hi just_joe_;

Client is a instantiated object of type TcpClient. So in the constructor of the ClientConnection pass in the TcpClient of the object you want the remote IP address of.


Author Closing Comment

ID: 31428985
Thank you
LVL 64

Expert Comment

by:Fernando Soto
ID: 20909849
Not a problem, glad to help. ;=)

Author Comment

ID: 20940348
Located an answer for anyone who needs it.


Code Below
Imports System.Net
Public Class Form1
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim addrs() As IPAddress = Dns.GetHostAddresses(Dns.GetHostName)
    If addrs.Length > 0 Then Label1.Text = addrs(0).ToString()
  End Sub
End Class

Open in new window


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…

624 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