Programmatically finding IP address of another computer on LAN

社会主义新天地 提交于 2019-12-12 05:52:54

问题


I want to programmatically obtain the IP address of a computer on the LAN, given its hostname.

I know from the command line i can do this by ping < hostname >, but how can i do this programmatically in objective-c? Thanks.


回答1:


Ok, gethostbyname() always works when trying to find the ip address given a hostname, as long as the hostname of the computer you ae trying to access has its name registered in a DNS Server. All comments and answers above were useful.



来源:https://stackoverflow.com/questions/11940341/programmatically-finding-ip-address-of-another-computer-on-lan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!