public void Connect() { lock (socketLock) { if (IsWork) { return; } IsWork = true; ConnectionData.ConnectionOpening(); } ConnectionStatus = ConnectionData.IncludeDataBlock <ConnectionStatus>(); EncDec = ConnectionStatus.EncDec; ReceiveStream.Clear(); try { socket = ConnectionStatus.GameServer.Connect(); StartReceive(); if (Connected != null) { Connected(this, new EventArgs()); } } catch { IsWork = false; if (Disconnected != null) { Disconnected(this, new EventArgs()); } } }