enum枚举
public Socket(SocketType 插座类型, ProtocolType 协议类型)【819】
: this(AddressFamily.InterNetworkV6, socketType, protocolType)。
public Socket(AddressFamily 地址家庭, SocketType 插座类型, ProtocolType 协议类型)
。
public unsafe Socket(SocketInformation 插座对象)
。
Socket s = new Socket(
AddressFamily.InterNetwork,【2】
SocketType.Stream,【1】
ProtocolType.Tcp); 【6】//监控 ip4 地址,套接字类型为 TCP ,协议类型为 TCP
public enum SocketType 插座类型
{
Stream = 1, 数据流,TCP可靠连接
Dgram = 2, UDP不可靠
Raw = 3, 原始套接字,ICMP,IGMP协议包
Rdm = 4, 消息
Seqpacket = 5, 排序字节流,可靠的
Unknown = -1 未知
}
public enum ProtocolType 协议类型
{
IP = 0,
IPv6HopByHopOptions = 0,
Icmp = 1,
Igmp = 2,
Ggp = 3,
IPv4 = 4,
Tcp = 6,
Pup = 12,
Udp = 17,
Idp = 22,
IPv6 = 41,
IPv6RoutingHeader = 43,
IPv6FragmentHeader = 44,
IPSecEncapsulatingSecurityPayload = 50,
IPSecAuthenticationHeader = 51,
IcmpV6 = 58,
IPv6NoNextHeader = 59,
IPv6DestinationOptions = 60,
ND = 77,
Raw = 255,
Unspecified = 0,
Ipx = 1000,
Spx = 1256,
SpxII = 1257,
Unknown = -1
}
public enum AddressFamily 地址家庭【默认23】
{
Unknown = -1,
Unspecified = 0,
Unix = 1,
InterNetwork = 2,
ImpLink = 3,
Pup = 4,
Chaos = 5,
NS = 6,
Ipx = 6,
Iso = 7,
Osi = 7,
Ecma = 8,
DataKit = 9,
Ccitt = 10,
Sna = 11,
DecNet = 12,
DataLink = 13,
Lat = 14,
HyperChannel = 15,
AppleTalk = 16,
NetBios = 17,
VoiceView = 18,
FireFox = 19,
Banyan = 21,
Atm = 22,
InterNetworkV6 = 23,
Cluster = 24,
Ieee12844 = 25,
Irda = 26,
NetworkDesigners = 28,
Max = 29
}
public struct SocketInformation
{
private byte[] protocolInformation;
private SocketInformationOptions options;
[OptionalField]
private EndPoint remoteEndPoint;
public byte[] ProtocolInformation
{
get
{
return protocolInformation;
}
set
{
protocolInformation = value;
}
}
public SocketInformationOptions Options
{
get
{
return options;
}
set
{
options = value;
}
}
internal bool IsNonBlocking
{
get
{
return (options & SocketInformationOptions.NonBlocking) != 0;
}
set
{
if (value)
{
options |= SocketInformationOptions.NonBlocking;
}
else
{
options &= ~SocketInformationOptions.NonBlocking;
}
}
}
internal bool IsConnected
{
get
{
return (options & SocketInformationOptions.Connected) != 0;
}
set
{
if (value)
{
options |= SocketInformationOptions.Connected;
}
else
{
options &= ~SocketInformationOptions.Connected;
}
}
}
internal bool IsListening
{
get
{
return (options & SocketInformationOptions.Listening) != 0;
}
set
{
if (value)
{
options |= SocketInformationOptions.Listening;
}
else
{
options &= ~SocketInformationOptions.Listening;
}
}
}
internal bool UseOnlyOverlappedIO
{
get
{
return (options & SocketInformationOptions.UseOnlyOverlappedIO) != 0;
}
set
{
if (value)
{
options |= SocketInformationOptions.UseOnlyOverlappedIO;
}
else
{
options &= ~SocketInformationOptions.UseOnlyOverlappedIO;
}
}
}
internal EndPoint RemoteEndPoint
{
get
{
return remoteEndPoint;
}
set
{
remoteEndPoint = value;
}
}
}
Available
OSSupportsIPv4
LegacySupportsIPv6
OSSupportsIPv6
LocalEndPoint
RemoteEndPoint
Handle