Ejemplo n.º 1
0
 private bool ReceiveMessageHeader(MsgHeader hdr, SocketClientBase cl)
 {
     try
     { hdr.Load(cl.NetStream, Protocol); }
     catch (MessageLoadException e)
     {
         if (NetUtil.CheckConnectionReset(e))
         {
             OnClientConnectionReset(cl);
         }
         else
         {
             Root.Log(LogLevel.Warning, "Client {0} : bad message header ({1})",
                      GetClientName(cl), e.Message);
             DisconnectClient(cl, DisconnectReason.Unknown, "bad message header");
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 private bool ReceiveMessageHeader(MsgHeader hdr)
 {
     try
     {
         hdr.Load(netStream, cfg.Protocol);
     }
     catch (MessageLoadException e)
     {
         if (NetUtil.CheckConnectionReset(e))
         {
             OnServerConnectionReset();
         }
         else
         {
             Root.Log(LogLevel.Warning, "Client: bad message header received from server ({0})", e.Message);
             Disconnect();
         }
         return(false);
     }
     return(true);
 }