/// <summary> /// Подключается к серверу /// </summary> public static AsynchronousClient Connect(IPEndPoint remoteEndPoint) { try { var newClient = new AsynchronousClient(remoteEndPoint); var connectionObject = new ClientConnectionObject(newClient, remoteEndPoint); newClient.Socket.BeginConnect(remoteEndPoint, ConnectCallback, connectionObject); newClient._connectDone.WaitOne(); return(newClient); } catch (Exception e) { Debug.Log(e); } return(null); }
public ClientStateObject(AsynchronousClient client) { Client = client; _messageLength = 0; Buffer = new byte[client.IsClientSide ? Params.CLIENT_BUFFER_SIZE : Params.SERVER_BUFFER_SIZE]; }
public ClientConnectionObject(AsynchronousClient client, IPEndPoint remoteEndPoint) { Client = client; RemoteEndPoint = remoteEndPoint; }