473,413 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Retrieving Remote IP Address from TCP Socket

-J
When connecting to a server application via a TCP socket connection, how do I retrieve the IP Address of the client computer that is making the connection.

I create and IPEndPoint for the client, then call the connect using the endpoint.

The server application uses TCPListener to pick up client connections.

At this point I want to store the client's IP Address that is making the connection.

Thanks for the help.

-J

___
Newsgroups brought to you courtesy of www.dotnetjohn.com
Nov 21 '05 #1
1 3673
On Tue, 10 Aug 2004 06:00:11 -0700, -J wrote:
When connecting to a server application via a TCP socket connection, how do I retrieve the IP Address of the client computer that is making the connection.

I create and IPEndPoint for the client, then call the connect using the endpoint.

The server application uses TCPListener to pick up client connections.

At this point I want to store the client's IP Address that is making the connection.

Thanks for the help.

-J

___
Newsgroups brought to you courtesy of www.dotnetjohn.com


If your using the TcpClient class for the new connections - you can't,
unless you create your own class that inherits from TcpClient because you
have to access the protected Client property of the TcpClass...

If your using a Socket (TcpListner.AcceptSocket) - then you can use
connections RemoteEndPoint property...

Dim ep as IPEndPoint = DirectCast (clientConnection.RemoteEndPoint,
IPEndPoint)

Dim clientIp As IPAddress = ep.Address
Dim clientPort As Integer = ep.Port

HTH
--
Tom Shelton [MVP]
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tim Gosselin | last post by:
I am writing a tcp tunnel but cannot find a way of detecting when a socket shuts down its read end without writing to the socket. For testing the write end of the remote endpoint I just do a: if...
1
by: Ethan | last post by:
Hi, In quite a fix here. Hope someone can help ASAP. I need to get the IP address of the client that connects when I use TcpListener.AcceptTcpConnections. I know I can get the information...
2
by: Lalasa | last post by:
Hi, I wrote a FTP Client library and this is how I make a socket connection. But this doesnt work for a remote ftp site. It fails at Dns.Resolve. How do I make a socket connection for a remote...
6
by: Khadim | last post by:
I am using the following code, don't know what am i missing. in BYTE2 I am not getting any information from the remote application. any guidance would be highly appreciated, thanking you in advance...
3
by: Wayne And Miles | last post by:
I have created a server application that listens for connections using the TCPListener class. When I connect to the server using a client on the same machine as the server, all works as expected. ...
0
by: cmrhema | last post by:
Hello, We are currently using a program where we recieve the details from the client. Developed in C#.It is recieved through sockets. It is working fine. i.e. When we start the program afresh we...
0
by: sbsrulz | last post by:
Hi all... I am using the parlay x third party call web service in my c# application. I coded a little and called the main functionality for making a call. Now when i test the service... Its there,...
3
by: Jason | last post by:
I am working on an asynchronous UDP socket server platform, and I am running into what appears to be a common problem but I have not found a good answer yet. If this was TCP, when the routine...
1
by: manjuramesh | last post by:
Hi, I was working on a client server issue and did the following in the client code: DatagramSocket socket = new DatagramSocket(); socket.setSoTimeout(1000); ..... DatagramPacket...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.