mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-10-29 12:06:51 +00:00
AutoReconnect
This commit is contained in:
1 parent
af94ce318a
commit
21a2061fc4
12 files changed
+355
-154
No files matched your search
@@ -158,8 +158,8 @@ public class TCPSocket : ISocket
|
||||
{
|
||||
|
||||
state = SocketState.Established;
|
||||
//OnConnect?.Invoke();
|
||||
Receiver?.NetworkConnect(this);
|
||||
//OnConnect?.Invoke();
|
||||
Receiver?.NetworkConnect(this);
|
||||
Begin();
|
||||
rt.Trigger(true);
|
||||
}
|
||||
@@ -396,32 +396,32 @@ public class TCPSocket : ISocket
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (state != SocketState.Closed)// && state != SocketState.Terminated)
|
||||
if (state == SocketState.Closed)
|
||||
return; // && state != SocketState.Terminated)
|
||||
|
||||
state = SocketState.Closed;
|
||||
|
||||
if (sock.Connected)
|
||||
{
|
||||
state = SocketState.Closed;
|
||||
|
||||
if (sock.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
sock.Shutdown(SocketShutdown.Both);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sendBufferQueue?.Clear();
|
||||
Receiver?.NetworkClose(this);
|
||||
sock.Shutdown(SocketShutdown.Both);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
Global.Log(ex);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sendBufferQueue?.Clear();
|
||||
Receiver?.NetworkClose(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Global.Log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Send(byte[] message)
|
||||
@@ -543,7 +543,7 @@ public class TCPSocket : ISocket
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
|
||||
|
||||
Close();
|
||||
|
||||
receiveNetworkBuffer = null;
|
||||
@@ -560,7 +560,7 @@ public class TCPSocket : ISocket
|
||||
OnDestroy?.Invoke(this);
|
||||
OnDestroy = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ISocket Accept()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user