Ejemplo n.º 1
0
 public bool Send(byte[] buffer, int offset, int length)
 {
     try
     {
         //buffer sending.
         int offst = 0;
         while (true)
         {
             byte[] outputdata = enc.ProcessOutputData(buffer, offst, (length - offst > 4096 ? 4096 : length - offst));
             offst += (length - offst > 4096 ? 4096 : length - offst);
             //craft headers & shit.
             //send outputdata's length firs.t
             if (enc.GetAuthType() != AuthTypes.Login && enc.GetAuthType() != AuthTypes.None)
             {
                 Client.Send(BitConverter.GetBytes(outputdata.Length));
             }
             Client.Send(outputdata, 0, outputdata.Length);
             if (offst >= buffer.Length)
             {
                 //exit;
                 return(true);
             }
         }
         return(true);
     }
     catch
     {
         throw new Exception();
     }
 }
Ejemplo n.º 2
0
 public bool Send(byte[] buffer, int offset, int length)
 {
     try
     {
         //buffer sending.
         int offst = 0;
         while (true)
         {
             byte[] outputdata = enc.ProcessOutputData(buffer, offst, (length - offst > 4092 ? 4092 : length - offst));
             offst += (length - offst > 4092 ? 4092 : length - offst);
             //craft headers & shit.
             //send outputdata's length firs.t
             if (enc.GetAuthType() != AuthTypes.Login && enc.GetAuthType() != AuthTypes.None)
             {
                 byte[] datatosend = new byte[outputdata.Length + 4];
                 Buffer.BlockCopy(outputdata, 0, datatosend, 4, outputdata.Length);
                 Buffer.BlockCopy(BitConverter.GetBytes(outputdata.Length), 0, datatosend, 0, 4);
                 outputdata = null;
                 outputdata = datatosend;
             }
             Client.Send(outputdata, 0, outputdata.Length);
             if (offst >= buffer.Length)
             {
                 //exit;
                 return(true);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }