ReuseAddress requires Socket level

This commit is contained in:
Sanae 2022-04-02 20:58:57 -06:00
parent cc5c86091e
commit a0a53ff7bf
1 changed files with 1 additions and 1 deletions

View File

@ -17,7 +17,7 @@ public class Server {
public async Task Listen(CancellationToken? token = null) {
Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
serverSocket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.ReuseAddress, true);
serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
serverSocket.Bind(new IPEndPoint(IPAddress.Parse(Settings.Instance.Server.Address), Settings.Instance.Server.Port));
serverSocket.Listen();