471,315 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

networking help


Code:

IPAddress iadd =IPAddress.Parse("192.168.1.2");
IPEndPoint ipe = new IPEndPoint(iadd, port);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream
,ProtocolType.Tcp);
sock.Bind(ipe);
sock.Listen(32);
sock.Accept();
sock.Connect()// problem i dont know remote ip address nor can i hard
code it
web(sock);
sock.Shutdown(SocketShutdown.Both);
sock.Close();
how can i find about the ip address of remote client

Dec 1 '05 #1
1 1100
lucifer,

When you call the Accept method, it returns a Socket instance
representing the connection. On that instance, access the RemoteEndPoint
property to get the EndPoint which represents the ip address of the remote
client.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"lucifer" <um**********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

Code:

IPAddress iadd =IPAddress.Parse("192.168.1.2");
IPEndPoint ipe = new IPEndPoint(iadd, port);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream
,ProtocolType.Tcp);
sock.Bind(ipe);
sock.Listen(32);
sock.Accept();
sock.Connect()// problem i dont know remote ip address nor can i hard
code it
web(sock);
sock.Shutdown(SocketShutdown.Both);
sock.Close();
how can i find about the ip address of remote client

Dec 1 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by hyperbob | last post: by
7 posts views Thread by Brian Keogh | last post: by
46 posts views Thread by H.A. Sujith | last post: by
4 posts views Thread by Raj | last post: by
4 posts views Thread by uppili4chi | last post: by
42 posts views Thread by =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post: by

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.