本文介绍了客户端需要服务器动态IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,
我需要获取服务器动态IP地址给客户端以进行连接过程

更多详细信息:
我正在使用端口和IP地址进行服务器和客户端的文件传输过程(双向通信),如果服务器是静态的,则它的工作正常,如果是动态的话,我需要在运行时获取客户端的服务器IP地址我怎么了!



HI ,
I need to get the server Dynamic Ip address to client for connectivity process

More details :
i am doing server & client file transfer process (its a 2ways communication ) using port & IP address , if server is a static no problem its working fine ,if in-case dynamic i need to get the server ip address for client at run time how come i!!



can any one help me will be more thankful!!

推荐答案

string webaddress= "www.codeproject.com";
IPAddress[] ips = Dns.GetHostAddresses(webaddress);
foreach (IPAddress ip in ips)
   {
   Console.WriteLine(ip.ToString());
   }


这篇关于客户端需要服务器动态IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:31
查看更多