/// <summary> /// 读取一般传输包 /// </summary> /// <returns>返回读取的一般传输包</returns> public byte[] ReceiveNormalPacket() { byte[] result = handler.ReceiveNormalPacket(); foreach (PacketLogger logger in loggers) { logger.Write(result, EndPoint); } return(result); }
/// <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); }