我希望从以下位置获取IP 地址
服务器端
TcpListener ftp_listener = new TcpListener(IPAddress.Any, ftpport);
newclient = listener.AcceptTcpClient();
Run Code Online (Sandbox Code Playgroud)
请问如何找到新客户端的IP 地址
客户端
TcpClient ftpclient = new TcpClient();
ftpclient.Connect(ipAddress, ftpport);
Run Code Online (Sandbox Code Playgroud)
如何找到ftpclient ip 地址
目前我正在使用
TcpClient ftpclient = new TcpClient();
//get IpAddress of Server
#pragma warning disable CS0618 // Type or member is obsolete
IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0];
#pragma warning restore CS0618 // Type or member is obsolete
ftpclient.Connect(ipAddress, ftpport);// "192.168.1.160", ftpport);
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法 ...
谢谢