Dreamine.Communication.Sockets
1.0.2
Dreamine.Communication.Sockets 통신 기능과 관련 API를 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
UdpTransportOptions.cs
이 파일의 문서화 페이지로 가기
1
using
System.Net;
2
3
namespace
Dreamine.Communication.Sockets.Options
;
4
13
public
sealed
class
UdpTransportOptions
14
{
23
public
string
LocalHost
{
get
;
set
; } =
"127.0.0.1"
;
24
33
public
int
LocalPort
{
get
;
set
; } = 16001;
34
43
public
string
RemoteHost
{
get
;
set
; } =
"127.0.0.1"
;
44
53
public
int
RemotePort
{
get
;
set
; } = 16002;
54
63
public
int
ReceiveBufferSize
{
get
;
set
; } = 8192;
64
73
public
int
SendBufferSize
{
get
;
set
; } = 8192;
74
83
public
bool
EnableBroadcast
{
get
;
set
; }
84
93
public
bool
ReuseAddress
{
get
;
set
; }
94
111
public
IPEndPoint
CreateLocalEndPoint
()
112
{
113
return
new
IPEndPoint(
ParseHost
(
LocalHost
, allowAny:
true
),
LocalPort
);
114
}
115
132
public
IPEndPoint
CreateRemoteEndPoint
()
133
{
134
return
new
IPEndPoint(
ParseHost
(
RemoteHost
, allowAny:
false
),
RemotePort
);
135
}
136
177
private
static
IPAddress
ParseHost
(
string
host,
bool
allowAny)
178
{
179
ArgumentException.ThrowIfNullOrWhiteSpace(host);
180
181
if
(allowAny && host ==
"0.0.0.0"
)
182
{
183
return
IPAddress.Any;
184
}
185
186
if
(host ==
"127.0.0.1"
||
187
host.Equals(
"localhost"
, StringComparison.OrdinalIgnoreCase))
188
{
189
return
IPAddress.Loopback;
190
}
191
192
if
(IPAddress.TryParse(host, out var ipAddress))
193
{
194
return
ipAddress;
195
}
196
197
throw
new
ArgumentException($
"Invalid UDP host: {host}"
, nameof(host));
198
}
199
}
Dreamine.Communication.Sockets.Options
Definition
TcpClientTransportOptions.cs:1
Dreamine.Communication.Sockets.Options.UdpTransportOptions
Definition
UdpTransportOptions.cs:14
Dreamine.Communication.Sockets.Options.UdpTransportOptions.LocalPort
int LocalPort
Definition
UdpTransportOptions.cs:33
Dreamine.Communication.Sockets.Options.UdpTransportOptions.CreateLocalEndPoint
IPEndPoint CreateLocalEndPoint()
Definition
UdpTransportOptions.cs:111
Dreamine.Communication.Sockets.Options.UdpTransportOptions.CreateRemoteEndPoint
IPEndPoint CreateRemoteEndPoint()
Definition
UdpTransportOptions.cs:132
Dreamine.Communication.Sockets.Options.UdpTransportOptions.LocalHost
string LocalHost
Definition
UdpTransportOptions.cs:23
Dreamine.Communication.Sockets.Options.UdpTransportOptions.ParseHost
static IPAddress ParseHost(string host, bool allowAny)
Definition
UdpTransportOptions.cs:177
Dreamine.Communication.Sockets.Options.UdpTransportOptions.ReceiveBufferSize
int ReceiveBufferSize
Definition
UdpTransportOptions.cs:63
Dreamine.Communication.Sockets.Options.UdpTransportOptions.SendBufferSize
int SendBufferSize
Definition
UdpTransportOptions.cs:73
Dreamine.Communication.Sockets.Options.UdpTransportOptions.RemotePort
int RemotePort
Definition
UdpTransportOptions.cs:53
Dreamine.Communication.Sockets.Options.UdpTransportOptions.ReuseAddress
bool ReuseAddress
Definition
UdpTransportOptions.cs:93
Dreamine.Communication.Sockets.Options.UdpTransportOptions.RemoteHost
string RemoteHost
Definition
UdpTransportOptions.cs:43
Dreamine.Communication.Sockets.Options.UdpTransportOptions.EnableBroadcast
bool EnableBroadcast
Definition
UdpTransportOptions.cs:83
Options
UdpTransportOptions.cs
다음에 의해 생성됨 :
1.17.0