예제 #1
0
 public QsTaskProcess(QsPackageHeader h, QsPackageData d)
 {
     header = h;
     data = d;
 }
예제 #2
0
 public QsDisplayClientContent(QsPackageHeader h, QsPackageData d)
     : base(h, d)
 {
     content = System.Text.Encoding.Default.GetString(d.dataBuffer);
 }
예제 #3
0
 public QsSendInfoToServer(string s)
 {
     data = new QsPackageData(System.Text.Encoding.Default.GetBytes(s));
     header = new QsPackageHeader(0x1, data);
 }
예제 #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);
         }
     }
 }
예제 #5
0
 public QsPackageHeader(int cmdType, QsPackageData data)
 {
     headerBuffer[0] = (byte)cmdType;
     BitConverter.GetBytes(data.dataLength).CopyTo(headerBuffer, 1);
 }
예제 #6
0
 public void SetPackageData(QsPackageData d)
 {
     data = d;
 }
예제 #7
0
 public QsNetIOSender(Socket s, QsPackageHeader h, QsPackageData d)
 {
     sendSocket = s;
     header = h;
     data = d;
 }
예제 #8
0
 public QsNetIOSender(string ip, int port, QsPackageHeader h, QsPackageData d)
 {
     Connect(ip, port);
     header = h;
     data = d;
 }