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