Revize a5c3168d
Přidáno uživatelem Oto Šťáva před téměř 4 roky(ů)
deltarobot-vr/Assets/DeltaRobotVr/Client.cs | ||
---|---|---|
46 | 46 |
|
47 | 47 |
private const int ReconnectPollMillis = 200; |
48 | 48 |
private const int ReconnectTimeMillis = 3000; |
49 |
|
|
49 |
private const int ConnectTimeoutMillis = 3000; |
|
50 | 50 |
|
51 | 51 |
private Thread _thread; |
52 | 52 |
|
... | ... | |
287 | 287 |
port = DefaultPort; |
288 | 288 |
} |
289 | 289 |
|
290 |
using var client = new TcpClient(host, port); |
|
290 |
using var client = new TcpClient(); |
|
291 |
var asyncConnect = client.BeginConnect(host, port, null, null); |
|
292 |
|
|
293 |
var connected = asyncConnect.AsyncWaitHandle.WaitOne(TimeSpan.FromMilliseconds(ConnectTimeoutMillis)); |
|
294 |
if (!connected) |
|
295 |
{ |
|
296 |
Debug.LogWarning("Connection not established - timed out"); |
|
297 |
continue; |
|
298 |
} |
|
299 |
|
|
291 | 300 |
using var stream = client.GetStream(); |
292 | 301 |
BinaryReader reader = new BinaryReader(stream); |
293 | 302 |
BinaryWriter writer = new BinaryWriter(stream); |
Také k dispozici: Unified diff
Re #9000 - On-site adjustments