我正在嘗試獲取綁定到receiveSock的IP地址。我怎麼才能得到它。如何從套接字獲得IP地址
QUES 1:
ipEndReceive = new IPEndPoint(IPAddress.Any, receivePort);
receiveSock = new Socket(AddressFamily.InterNetwork
, SocketType.Stream, ProtocolType.Tcp);
receiveSock.Bind(ipEndReceive);
當代碼到達綁定函數。發生錯誤
參數無效,錯誤代碼:10022, 消息:一個無效的參數是 供給
QUES 2:
ipEndReceive = new IPEndPoint(IPAddress.Parse("127.0.0.1"), receivePort);
receiveSock = new Socket(AddressFamily.InterNetwork
, SocketType.Stream, ProtocolType.Tcp);
receiveSock.Bind(ipEndReceive);
ErrorLog.WritetoErrorlog("\nRemote IP Address : " + ((IPEndPoint)receiveSock.RemoteEndPoint).Address.ToString()
當我與該IP試。它向我顯示與上面相同的錯誤
@tanascius:謝謝讓我意識到我的錯誤。我現在格式化了它。 – 2010-06-29 08:18:14
thx,閱讀和回答格式良好的問題真的很容易^^ – tanascius 2010-06-29 08:20:24