NetHelper Class
From HD.Common
| NetHelper Class | Helper帮助文档 |
网络操作相关的类
Inheritance Hierarchy
Namespace: HD.Common
Assembly: HD.Common (in HD.Common.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public class NetHelper
Public Class NetHelper
public ref class NetHelper
type NetHelper = class end
The NetHelper type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| NetHelper | Initializes a new instance of the NetHelper class |
Methods
| Name | Description | |
|---|---|---|
| BindEndPoint(Socket, IPEndPoint) |
绑定终结点
| |
| BindEndPoint(Socket, String, Int32) |
绑定终结点
| |
| Close |
关闭基于Tcp协议的Socket对象
| |
| Connect |
连接到基于TCP协议的服务器,连接成功返回true,否则返回false
| |
| CreateIPEndPoint |
创建一个IPEndPoint对象
| |
| CreateTcpListener |
创建一个自动分配IP和端口的TcpListener对象
| |
| CreateTcpListener(String, Int32) |
创建一个TcpListener对象
| |
| CreateTcpSocket |
创建一个基于TCP协议的Socket对象
| |
| CreateUdpSocket |
创建一个基于UDP协议的Socket对象
| |
| Equals | (Inherited from Object.) | |
| Finalize | (Inherited from Object.) | |
| GetClientIP |
获取远程客户机的IP地址
| |
| GetHashCode | (Inherited from Object.) | |
| GetLocalPoint(Socket) |
获取Socket对象的本地终结点
| |
| GetLocalPoint(TcpListener) |
获取TcpListener对象的本地终结点
| |
| GetLocalPoint_IP(Socket) |
获取Socket对象的本地终结点的IP地址
| |
| GetLocalPoint_IP(TcpListener) |
获取TcpListener对象的本地终结点的IP地址
| |
| GetLocalPoint_Port(Socket) |
获取Socket对象的本地终结点的端口号
| |
| GetLocalPoint_Port(TcpListener) |
获取TcpListener对象的本地终结点的端口号
| |
| GetType | (Inherited from Object.) | |
| GetValidPort |
检查设置的端口号是否正确,并返回正确的端口号,无效端口号返回-1。
| |
| MemberwiseClone | (Inherited from Object.) | |
| ReceiveMsg(Socket) |
以同步方式接收消息,并转换为UTF8编码格式的字符串,使用5000字节的默认缓冲区接收。
| |
| ReceiveMsg(Socket, Byte) |
以同步方式接收消息
| |
| SendEmail |
发送电子邮件,所有SMTP配置信息均在config配置文件中system.net节设置.
| |
| SendMsg(Socket, Byte) |
以同步方式向指定的Socket对象发送消息
| |
| SendMsg(Socket, String) |
使用UTF8编码格式以同步方式向指定的Socket对象发送消息
| |
| StartListen(Socket, Int32) |
指定Socket对象执行监听,默认允许的最大挂起连接数为100
| |
| StartListen(Socket, Int32, Int32) |
指定Socket对象执行监听
| |
| StartListen(Socket, String, Int32, Int32) |
指定Socket对象执行监听
| |
| StringToIPAddress |
将字符串形式的IP地址转换成IPAddress对象
| |
| ToString | (Inherited from Object.) |
Properties
| Name | Description | |
|---|---|---|
| LANIP |
获取本机的局域网IP
| |
| LocalHostName |
获取本机的计算机名
| |
| WANIP |
获取本机在Internet网络的广域网IP
|
See Also