コード例 #1
0
 /// <summary>
 /// Open a new client with default settings (everything beside accept is set to asynchronic).
 /// </summary>
 public NetworkClientBase(CommunicationSettings clientCommunicationSettings)
 {
     clientMode = NetworkClientMode.None;
     this.clientCommunicationSettings = clientCommunicationSettings;
     skt = new NetworkSocketManagerTCP();
     skt.OnSocketEvent += new NetworkSocketManagerTCP.DelegateSocketEventMethod(skt_OnSocketEvent);
 }
コード例 #2
0
 /// <summary>
 /// Open a new client by attaching an existing socket.
 /// </summary>
 /// <param name="socketManagerTCP">The socket to attach.</param>
 public NetworkClientBase(NetworkSocketManagerTCP socketManagerTCP)
 {
     clientMode = NetworkClientMode.None;
     skt = socketManagerTCP;
     skt.OnSocketEvent += new NetworkSocketManagerTCP.DelegateSocketEventMethod(skt_OnSocketEvent);
 }
コード例 #3
0
 /// <summary>
 /// Starts listening to incomming connections, use disconnect to finish listening.
 /// </summary>
 /// <param name="localTarget"> Where to listen to incomming connections.</param>
 /// <param name="maxPendingConnections">Amount of pending connection in case of congestion.</param>
 public void Listen(IPEndPoint localTarget, int maxPendingConnections)
 {
     clientMode = NetworkClientMode.Listener;
     skt.SocketEndPointsLink.LocalEndPoint = localTarget;
     skt.Listen(maxPendingConnections);
     skt.BlockingMode = clientCommunicationSettings.SyncUsesBlockingMode;
 }
コード例 #4
0
 /// <summary>
 /// Connect using the settings given through ClientCommunicationSettings.
 /// </summary>
 public void Connect(IPEndPoint remoteTarget)
 {
     clientMode = NetworkClientMode.Connecter;
     skt.SocketEndPointsLink.RemoteEndPoint = remoteTarget;
     skt.BlockingMode = clientCommunicationSettings.SyncUsesBlockingMode;
     switch (clientCommunicationSettings.Connect)
     {
         case CommunicationSettings.SocketOperationFlow.Synchronic:
             skt.Sync_Connect();
             break;
         case CommunicationSettings.SocketOperationFlow.Asynchronic:
             skt.Async_Connect();
             break;
     }
 }