1
0
mirror of https://github.com/oliverbooth/TcpDotNet synced 2024-11-10 08:15:41 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Oliver Booth
0db6fd2976
Merge 45111aae72 into 87cb461872 2024-02-12 22:57:27 +00:00
4 changed files with 3 additions and 9 deletions

View File

@ -11,10 +11,7 @@ client.Disconnected += (_, e) => Console.WriteLine($"Disconnected: {e.Disconnect
client.RegisterPacketHandler(PacketHandler<PongPacket>.Empty);
client.RegisterPacketHandler(new GoodbyePacketHandler());
var remoteEP = new IPEndPoint(IPAddress.Loopback, 1234);
Console.WriteLine($"Connecting to {remoteEP}");
await client.ConnectAsync(remoteEP);
await client.ConnectAsync(IPAddress.IPv6Loopback, 1234);
Console.WriteLine($"Connected to {client.RemoteEndPoint}. My session is {client.SessionId}");

View File

@ -10,10 +10,7 @@ listener.ClientDisconnected += (_, e) => Console.WriteLine($"Client {e.Client.Se
listener.RegisterPacketHandler(new HelloPacketHandler());
listener.RegisterPacketHandler(new PingPacketHandler());
Console.WriteLine("Starting listener");
listener.Start(1234);
Console.WriteLine($"Listener started on {listener.LocalEndPoint}");
await Task.Delay(-1);

View File

@ -91,7 +91,7 @@ public sealed class ProtocolClient : ClientNode
}
IsConnected = true;
RemoteEndPoint = BaseSocket.RemoteEndPoint!;
RemoteEndPoint = BaseSocket.RemoteEndPoint;
State = ClientState.Handshaking;
var handshakeRequest = new HandshakeRequestPacket(ProtocolVersion);

View File

@ -109,7 +109,7 @@ public sealed partial class ProtocolListener : Node
BaseSocket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, false);
BaseSocket.Bind(localEP);
BaseSocket.Listen();
BaseSocket.Listen(10);
IsRunning = true;
Started?.Invoke(this, EventArgs.Empty);