Skip to content

Commit 9972686

Browse files
committed
fix connect 1 and some timeouts
1 parent e842e7c commit 9972686

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Bridge/BridgeTCPUDP.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public static void ListenFromClientTCP() {
118118
while (true) {
119119
tcpToClient = tcpListener.AcceptTcpClient();
120120
form.Log("client connected\n", Color.Green);
121+
tcpToClient.ReceiveTimeout = 100;
122+
tcpToClient.SendTimeout = 100;
121123

122124
tcpToClient.NoDelay = true;
123125
Stream stream = tcpToClient.GetStream();
@@ -137,6 +139,7 @@ public static void ListenFromClientTCP() {
137139
}
138140
catch (ObjectDisposedException) { }
139141
catch (IOException) { }
142+
tcpToClient.Close();
140143
switch (status) {
141144
case BridgeStatus.Offline://server crashed
142145
break;

Resources/Player.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public IPAddress IP {
2020
}
2121

2222
public Player(TcpClient tcpClient) {
23+
tcpClient.SendTimeout = 5000;
24+
//tcpClient.ReceiveTimeout = 60000;
2325
this.tcpClient = tcpClient;
2426
var stream = tcpClient.GetStream();
2527
reader = new BinaryReader(stream);

0 commit comments

Comments
 (0)