IP addresses in C#
在.Net网络库里面最大的优点就是IP地址和端口被成对处理,相比于UNIX中用的方法真是一个巨大的令人欢迎的进步。.NET定义了两个类来处理关于IP地址的问题。
One of the biggest advantages you will notice in the .NET network library is the way IP address/port pairs are handled. It is a fairly straightforward process that presents a welcome improvement over the old, confusing UNIX way. .NET defines two classes in the System.Net namespace to handle various types of IP address information:
IPAddressIPEndPoint
IPAddress
一个IP地址对象用来表示一个单一的IP地址,其值同时也可以应用在许多不同的方法里面。
An IPAddress object is used to represent a single IP address. This value is then used in various socket methods to represent the IP address. The default constructor for IPAddress is as follows:
public IPAddress(long address)
实际上,默认的构造函数几乎是用不到的,因为在该类里面许多的函数可以用来构造并操作IP地址对象。其中Parser()函数经常用来构造该类。
The default constructor takes a long value and converts it to an IPAddress value. In practice, the default is almost never used. Instead, several methods in theIPAddress class can be used to create and manipulate IP addresses. The Parse() method is often used to create IPAddress instances:
IPAddress newaddress = IPAddress.Parse("192.168.1.1");
IPEndPoint
.NET框架用IPEndPoint 对象来表示一个特定的IP地址和端口的组合,应用该对象的场景多是在讲socket绑定到本地地址或者将socket绑定到非本地地址。
The .NET Framework uses the IPEndPoint object to represent a specific IP address/port combination. An IPEndPoint object is used when binding sockets to local addresses, or when connecting sockets to remote addresses.
IP addresses in C#的更多相关文章
- 【leetcode】Restore IP Addresses
Restore IP Addresses Given a string containing only digits, restore it by returning all possible val ...
- 保留ip: Reserved IP addresses
Reserved IP addresses From Wikipedia, the free encyclopedia In the Internet addressing architect ...
- 93. Restore IP Addresses
题目: Given a string containing only digits, restore it by returning all possible valid IP address com ...
- 93.Restore IP Addresses(M)
93.Restore IP Addresses Medium 617237FavoriteShare Given a string containing only digits, restore it ...
- 亚马逊 AWS ip反向解析:Configurable Reverse DNS for Amazon EC2’s Elastic IP Addresses
I’d like to call your attention to a new feature that we rolled out earlier this month. You can now ...
- "cni0" already has an IP address different from 10.244.2.1/24。 Error while adding to cni network: failed to allocate for range 0: no IP addresses available in range set: 10.244.2.1-10.244.2.254
"cni0" already has an IP address different from 10.244.2.1/24. Error while adding to cni n ...
- 【LeetCode】93. Restore IP Addresses
Restore IP Addresses Given a string containing only digits, restore it by returning all possible val ...
- LeetCode: Restore IP Addresses 解题报告
Restore IP Addresses My Submissions Question Solution Given a string containing only digits, restore ...
- LeetCode解题报告—— Reverse Linked List II & Restore IP Addresses & Unique Binary Search Trees II
1. Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass ...
随机推荐
- UVa 242 邮票和信封(完全背包)
https://vjudge.net/problem/UVA-242 题意: 输入s(每个信封能粘贴的最多邮票数量)和若干邮票组合,选出最大连续邮资最大的一个组合(最大连续邮资也就是用s张以内的邮票来 ...
- nohup 与 &
&的意思是在后台运行, 什么意思呢? 意思是说, 当你在执行 ./a.out & 的时候, 即使你用ctrl C, 那么a.out照样运行(因为对SIGINT信号免疫). 但是要注 ...
- shell 脚本拼接
var21=`echo $vvar|awk -F ',' '{print $1}'` echo $var21 var31=`echo $var21|awk -F ':' '{print $2}'` e ...
- 转载:理解RESTful架构
http://www.ruanyifeng.com/blog/2011/09/restful.html 越来越多的人开始意识到,网站即软件,而且是一种新型的软件. 这种"互联网软件" ...
- gulp4小demo
本来想着用gulp搭建一个自动化构建工具,结果一顿报错,后来发现我重新安装的gulp版本是4.0.0,与3版本还是不太一样的,遂记之. Gulp 3版本Demo: const gulp = requi ...
- Java多线程之内存可见性和原子性:Synchronized和Volatile的比较
Java多线程之内存可见性和原子性:Synchronized和Volatile的比较 [尊重原创,转载请注明出处]http://blog.csdn.net/guyuealian/article ...
- C语言的的free和c++的delete的区别
首先free对应的是malloc:delete对应的是new:free用来释放malloc出来动态内存,delete用来释放new出来的动态内存空间. 应用的区别为: 1. 数组的时候int *p=( ...
- 敏感性、特异性、假阳性、假阴性(sensitivity and specificity)
医学.机器学习等等,在统计结果时时长会用到这两个指标来说明数据的特性. 定义 敏感性:在金标准判断有病(阳性)人群中,检测出阳性的几率.真阳性.(检测出确实有病的能力) 特异性:在金标准判断无病(阴性 ...
- mysql语句查询时间检测
explain的使用 1.首先我们是要登入你的mysql的,然后选择数据库输入:use 你要选择的库名 2执行语句 eg: explain SELECT * FROM wish_orders1412 ...
- CodeForces 558B
Description Amr has got a large array of size n. Amr doesn't like large arrays so he intends to make ...