コード例 #1
0
 /// <summary>
 /// 读取一般传输包
 /// </summary>
 /// <returns>返回读取的一般传输包</returns>
 public byte[] ReceiveNormalPacket()
 {
     byte[] result = handler.ReceiveNormalPacket();
     foreach (PacketLogger logger in loggers)
     {
         logger.Write(result, EndPoint);
     }
     return(result);
 }
コード例 #2
0
 /// <summary>
 /// 打开连接
 /// </summary>
 public void Open()
 {
     if (isOpen)
     {
         throw new DbProxyException("连接已经打开!");
     }
     socket.Connect(url, port);
     socket.ReceiveTimeout = timeout;
     handler = new PacketHandler(socket);
     byte[] sndMsg = BuildOpenPacket();
     handler.SendNormalPacket(sndMsg);
     byte[] rcvMsg = handler.ReceiveNormalPacket();
     isOpen = CheckOpenPacket(rcvMsg);
 }