Hi Ankit,
In this current situation, I suggest you could try to invoke getpeername /
getsockname using PInvoke mechanism. On a connected socket, getpeername
will give you the remote address and getsockname will give you the local
address for the connection. We could use Socket.Handle Property to get the
socket handle and pass it into these API as parameters.
I hope the above inforamtion is helpful for you.If you have any questions
or concerns, please let me know. Thanks again and have a nice day!
Best Regards,
Terry Fei[MSFT]
Microsoft Community Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Best Regards,
--------------------
From: "Ankit Aneja" <ef*****@newsgroups.nospam>
References: <ea**************@TK2MSFTNGP15.phx.gbl>
<uC**************@TK2MSFTNGP11.phx.gbl> <43************@newsgroups.nospam>
<#j**************@TK2MSFTNGP09.phx.gbl>
<ul*************@tk2msftngp13.phx.gbl>
<eG*************@TK2MSFTNGP14.phx.gbl>Subject: Re: get client ip address in C# socket client application
Date: Wed, 18 Jan 2006 19:09:11 +0530
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
Message-ID: <#b*************@TK2MSFTNGP15.phx.gbl>
Newsgroups:
vitaly_at_zayko_dot_net,microsoft.public.dotnet.la nguages.csharpNNTP-Posting-Host: dsl-del-dynamic-145.85.246.61.touchtelindia.net
61.246.85.145Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.csharp:379374
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
i am not able to get .RemoteEndpoint after cl[i].
in next line to accept client
cl[i]= new client(server.AcceptTcpClient());
cl[i].?RemoteEndpoint is not displayed
"Vitaly Zayko" <vitaly_at_zayko_dot_net> wrote in message
news:eG*************@TK2MSFTNGP14.phx.gbl... AcceptTcpClient() return a TcpClient class. It has Client property which
is a Socket. Thus you can get IPEndPoint and its IP as I mentioned in my
last message.
cl[i]= new client(server.AcceptTcpClient());
--
Vit Zayko