.Net:解析IP地址字符串 [英] .Net: Parse IP address String
本文介绍了.Net:解析IP地址字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
只想问我如何将声明为String的IP地址转换为IPAddress类型?我提出String IP地址的原因是因为它来自一个文件。 socket类的connect方法需要IPaddress或主机。
希望你能帮助我...
解决方案
IPAddress ipAddr = IPAddress.Parse(strHostName);
您好romcab
我更改了您的主题标题,使其更有意义且更适合您的查询
请记住为任何已启动的线程提供有意义的标题(请为新主题使用适当的标题!)。这有助于确保其他成员以及公众更有机会找到任何类似问题的答案。
- Shashi
< blockquote>嗨..
我没有主机名,我只有一个IP地址,但它在类型字符串上,因为我在文本文件上得到它。我的问题是如何将String类型的IpAdd翻译为IPAdress类型..
谢谢
IPAddress ipAddr = IPAddress.Parse(strHostName);
Hi guys,
just want to ask how can I convert an IP address that is declared as String to type IPAddress? The reason why I come up with String IP address is because it came from a file. the connect method of socket class need IPaddress or host.
Hope you can help me...
解决方案
IPAddress ipAddr = IPAddress.Parse(strHostName);
Hi romcab
I changed your Topic title to make it more meaningful and appropriate to your query
Please remember to provide a meaningful Title for any threads started (Please Use Appropriate Titles for New Threads!). This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.
- Shashi
Hi..
I dont have the hostname, I only have an Ip address but it''s on type String since I get it on a textfile. My question is how can I translate the IpAdd of type String to type IPAdress..
Thanks
IPAddress ipAddr = IPAddress.Parse(strHostName);
这篇关于.Net:解析IP地址字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文