0
ipEndReceive = new IPEndPoint(IPAddress.Parse("127.0.0.1"), receivePort);
receiveSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream
, ProtocolType.Tcp);
ErrorLog.WritetoErrorlog("Trying to Bind IP Address Stored in Variable : "
+ipEndReceive.Address.ToString()
+"\n Port No :"+ipEndReceive.Port.ToString(), logPath);
receiveSock.Bind(ipEndReceive);
ErrorLog.WritetoErrorlog("\nRemote IP Address : "
+ ((IPEndPoint)receiveSock.RemoteEndPoint).Address.ToString()
+ "\n Local IP:"
+ ((IPEndPoint)receiveSock.LocalEndPoint).Address.ToString()
, logPath);
这里由于这我不是能够得到请求已收到其中远程IP地址receiveSock.RemoteEndPoint
返回我的EndPoint
,而不是IPEndPoint
的情况下获得一个IP地址。 我们有什么办法从这个套接字中获取它。如何从一个IPEndPoint在插座
可能重复[如何从Socket获取IP地址](http://stackoverflow.com/questions/3138885/how-to-get-an-ip-address-from-socket) – 2010-06-29 08:24:43
@ ho1:我认为这与前一个问题密切相关我问。但这里的问题有点不同,在这里我指出从** EndPoint获取IP地址** – 2010-06-29 08:27:00
EndPoint是一个抽象类,我没有得到问题,演员是否失败? – 2010-06-29 08:27:43