PC Review


Reply
Thread Tools Rate Thread

TCPClient and Get the IPAddress of the Client

 
 
=?Utf-8?B?QnJpYW5H?=
Guest
Posts: n/a
 
      2nd Feb 2004
How Can I get the IPAddress of the client connecting to my server
I understand that it is available after using AcceptSocket, but I already wrote everything with AcceptTCPClient
I just want the IPAddress for Logging purposes

Thanks
bria

sscsin
..com
 
Reply With Quote
 
 
 
 
Chris Taylor
Guest
Posts: n/a
 
      2nd Feb 2004
Hi,

The TcpClient class has a Client property, this will give you the underlying
Socket object on which you can call RemoteEndPoint.

Hope this helps

--
Chris Taylor
http://dotnetjunkies.com/WebLog/chris.taylor/
"BrianG" <brian@use_sig_in_post.com> wrote in message
news:5E5A7DDE-7224-40E3-B859-(E-Mail Removed)...
> How Can I get the IPAddress of the client connecting to my server?
> I understand that it is available after using AcceptSocket, but I already

wrote everything with AcceptTCPClient.
> I just want the IPAddress for Logging purposes.
>
> Thanks,
> brian
> @
> sscsinc
> .com



 
Reply With Quote
 
Ed Kaim [MSFT]
Guest
Posts: n/a
 
      3rd Feb 2004
To clarify, you'll have to build a class that extends TcpClient, and then do
the work to expose the member data outside the class.

"Chris Taylor" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> The TcpClient class has a Client property, this will give you the

underlying
> Socket object on which you can call RemoteEndPoint.
>
> Hope this helps
>
> --
> Chris Taylor
> http://dotnetjunkies.com/WebLog/chris.taylor/
> "BrianG" <brian@use_sig_in_post.com> wrote in message
> news:5E5A7DDE-7224-40E3-B859-(E-Mail Removed)...
> > How Can I get the IPAddress of the client connecting to my server?
> > I understand that it is available after using AcceptSocket, but I

already
> wrote everything with AcceptTCPClient.
> > I just want the IPAddress for Logging purposes.
> >
> > Thanks,
> > brian
> > @
> > sscsinc
> > .com

>
>



 
Reply With Quote
 
DalePres
Guest
Posts: n/a
 
      3rd Feb 2004
Or change from using TcpClient to using a Socket.

Dale

"Ed Kaim [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> To clarify, you'll have to build a class that extends TcpClient, and then

do
> the work to expose the member data outside the class.
>



 
Reply With Quote
 
Chris Capel
Guest
Posts: n/a
 
      3rd Feb 2004
When I had to do this, I forwent (forgoed?) the derived class and just used
reflection to get the "Client" property.

Chris

"Ed Kaim [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> To clarify, you'll have to build a class that extends TcpClient, and then

do
> the work to expose the member data outside the class.
>
> "Chris Taylor" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > The TcpClient class has a Client property, this will give you the

> underlying
> > Socket object on which you can call RemoteEndPoint.
> >
> > Hope this helps
> >
> > --
> > Chris Taylor
> > http://dotnetjunkies.com/WebLog/chris.taylor/
> > "BrianG" <brian@use_sig_in_post.com> wrote in message
> > news:5E5A7DDE-7224-40E3-B859-(E-Mail Removed)...
> > > How Can I get the IPAddress of the client connecting to my server?
> > > I understand that it is available after using AcceptSocket, but I

> already
> > wrote everything with AcceptTCPClient.
> > > I just want the IPAddress for Logging purposes.
> > >
> > > Thanks,
> > > brian
> > > @
> > > sscsinc
> > > .com

> >
> >

>
>



 
Reply With Quote
 
=?Utf-8?B?QnJpYW4=?=
Guest
Posts: n/a
 
      4th Feb 2004
I was blaming the AcceptSocket for my own stupidity. Once I realized that the code ws broken both ways, I went with AcceptSocket and all is working.

Thanks for the help and ideas.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Remoting] IPAddress of connected client Udo Nesshoever Microsoft C# .NET 2 21st Jul 2008 09:57 AM
C# FTP client using TcpClient class -- please help almurph@altavista.com Microsoft C# .NET 5 6th Mar 2008 03:40 AM
How can i get the client's ip use tcpclient? pam Microsoft VB .NET 1 21st Aug 2006 03:01 PM
Get Client Socket from TcpClient Joshua Ellul Microsoft Dot NET Framework 1 21st Oct 2004 07:52 PM
Getting IP of Client with TcpClient Kintwa Microsoft VB .NET 1 21st Jun 2004 10:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:33 PM.