pull/1/head
Ogoun 5 years ago
parent 3ff50a0d76
commit fe6eabb194

@ -12,6 +12,9 @@ namespace ZeroLevel.Network
IRouter UseHost();
IRouter UseHost(int port);
IRouter UseHostV6();
IRouter UseHostV6(int port);
IRouter UseHost(IPEndPoint endpoint);
IServiceRoutesStorage RoutesStorage { get; }

@ -633,6 +633,16 @@ namespace ZeroLevel.Network
return MakeHost(new IPEndPoint(IPAddress.Any, port));
}
public IRouter UseHostV6()
{
return MakeHost(new IPEndPoint(IPAddress.IPv6Any, NetUtils.GetFreeTcpPort()));
}
public IRouter UseHostV6(int port)
{
return MakeHost(new IPEndPoint(IPAddress.IPv6Any, port));
}
public IRouter UseHost(IPEndPoint endpoint)
{
return MakeHost(endpoint);

@ -61,7 +61,7 @@ namespace ZeroLevel.Network
{
try
{
_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_clientSocket = new Socket(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
_clientSocket.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
_clientSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
_clientSocket.Connect(ep);

@ -60,7 +60,7 @@ namespace ZeroLevel.Network
{
_router = router;
LocalEndpoint = endpoint;
_serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_serverSocket = new Socket(endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
_serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
_serverSocket.Bind(endpoint);
_serverSocket.Listen(100);

Loading…
Cancel
Save

Powered by TurnKey Linux.