public QsTaskProcess(QsPackageHeader h, QsPackageData d)
 {
     header = h;
     data = d;
 }
 public QsDisplayClientContent(QsPackageHeader h, QsPackageData d)
     : base(h, d)
 {
     content = System.Text.Encoding.Default.GetString(d.dataBuffer);
 }
 public QsSendInfoToServer(string s)
 {
     data = new QsPackageData(System.Text.Encoding.Default.GetBytes(s));
     header = new QsPackageHeader(0x1, data);
 }
Exemple #4
0
 public void ReceiveHeaderCallback(IAsyncResult ar)
 {
     QsNetIOStateObject headerState = (QsNetIOStateObject)ar.AsyncState;
     int bytesRead = receiveSocket.EndReceive(ar);
     if (bytesRead > 0)
     {
         headerState.count += bytesRead;
         if (headerState.count < QsPackageHeader.headerBufferSize)
             receiveSocket.BeginReceive(header.headerBuffer, headerState.count, QsPackageHeader.headerBufferSize - headerState.count, 0, new AsyncCallback(ReceiveHeaderCallback), headerState);
         else
         {
             QsNetIOStateObject dataState = new QsNetIOStateObject();
             data = new QsPackageData(header.GetDataLength());
             receiveSocket.BeginReceive(data.dataBuffer, dataState.count, data.dataLength - dataState.count, 0, new AsyncCallback(ReceiveDataCallback), dataState);
         }
     }
 }
Exemple #5
0
 public QsPackageHeader(int cmdType, QsPackageData data)
 {
     headerBuffer[0] = (byte)cmdType;
     BitConverter.GetBytes(data.dataLength).CopyTo(headerBuffer, 1);
 }
Exemple #6
0
 public void SetPackageData(QsPackageData d)
 {
     data = d;
 }
Exemple #7
0
 public QsNetIOSender(Socket s, QsPackageHeader h, QsPackageData d)
 {
     sendSocket = s;
     header = h;
     data = d;
 }
Exemple #8
0
 public QsNetIOSender(string ip, int port, QsPackageHeader h, QsPackageData d)
 {
     Connect(ip, port);
     header = h;
     data = d;
 }