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); }
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); } } }
public QsPackageHeader(int cmdType, QsPackageData data) { headerBuffer[0] = (byte)cmdType; BitConverter.GetBytes(data.dataLength).CopyTo(headerBuffer, 1); }
public void SetPackageData(QsPackageData d) { data = d; }
public QsNetIOSender(Socket s, QsPackageHeader h, QsPackageData d) { sendSocket = s; header = h; data = d; }
public QsNetIOSender(string ip, int port, QsPackageHeader h, QsPackageData d) { Connect(ip, port); header = h; data = d; }