Ejemplo n.º 1
0
 /// <summary>
 /// Set tcp client parameter.
 /// </summary>
 /// <param name="clientConfig">The client parameter, see SiS.Communication.Tcp.TcpClientParam.</param>
 public void SetTcpClientParam(TcpClientConfig clientConfig)
 {
     if (_clientStatus != ClientStatus.Closed)
     {
         throw new Exception("can not set tcp client parameter during running");
     }
     _tcpConfig = clientConfig;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the SiS.Communication.Tcp.TcpClientEx.
 /// </summary>
 /// <param name="autoReconnect">true if use auto reconnect feature; otherwise, false.</param>
 /// <param name="packetSpliter">The spliter which is used to split stream data into packets.</param>
 public TcpClientEx(bool autoReconnect, IPacketSpliter packetSpliter)
 {
     byte[] array = Guid.NewGuid().ToByteArray();
     _clientID      = BitConverter.ToInt64(array, 0);
     _packetSpliter = packetSpliter;
     _autoReconnect = autoReconnect;
     _tcpConfig     = new TcpClientConfig();
     //_tcpConfig = _tcpClientConfig;
     _reconnectWaitEvent = new ManualResetEvent(false);
     if (SynchronizationContext.Current == null)
     {
         SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
     }
     _syncContext = SynchronizationContext.Current;
 }