示例#1
0
 public TcpServer(long handle, long port, Tcp.Protocol protocol)
 {
     _handle   = handle;
     _protocol = protocol;
     _ip       = new IPEndPoint(IPAddress.Any, (int)port);
     _listener = new Socket(_ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
     _clients  = new Dictionary <long, TcpServerSession> ();
     _requests = new Dictionary <long, TcpServerSession> ();
     _inbox    = new TcpListenBox();
 }
示例#2
0
 public TcpClient(long handle, RCSymbolScalar symbol, Tcp.Protocol protocol, int timeout)
 {
     _protocol     = protocol;
     _handle       = handle;
     _host         = (string)symbol.Part(1);
     _port         = (long)symbol.Part(2);
     _inbox        = new TcpReceiveBox();
     _outbox       = new TcpOutBox();
     _buffer       = new TcpMessageBuffer();
     _timeout      = timeout;
     _timeoutTimer = null;
 }