コード例 #1
0
ファイル: FileClient.cs プロジェクト: branan/PlasmaDotNet
        protected override void IOnConnect()
        {
            fStream = new plBufferedStream(new NetworkStream(fSocket, false));
            fConnHdr.Write(fStream);
            fStream.WriteUInt(12); // Complete BS below, but who cares?
            fStream.WriteUInt(0);
            fStream.WriteUInt(0);
            fStream.Flush();

            // File connections send an Int32 length, then the Int32 msgID
            fStream.PrependLength = true;
            base.IOnConnect();
        }
コード例 #2
0
ファイル: NsBase.cs プロジェクト: branan/PlasmaDotNet
 /// <summary>
 /// Sends a NetStruct over some (network backed) stream
 /// </summary>
 /// <param name="s">Stream to write to</param>
 public void Send(plBufferedStream s)
 {
     if (MsgID is UInt32)
         s.WriteUInt((uint)MsgID);
     else if (MsgID is UInt16)
         s.WriteUShort((ushort)MsgID);
     else
         throw new NotSupportedException();
     Write(s);
     s.Flush();
 }