コード例 #1
0
ファイル: WSProtocal.cs プロジェクト: 13777281504/SAEA
 public WSProtocal(WSProtocalType type, byte[] content)
 {
     this.Type = (byte)type;
     if (content != null)
         this.BodyLength = content.Length;
     else
         this.BodyLength = 0;
     this.Content = content;
 }
コード例 #2
0
ファイル: WSServerImpl.cs プロジェクト: ywscr/SAEA
        private void ReplyBase(string id, WSProtocalType type, byte[] content)
        {
            var bs = new WSProtocal(type, content);

            ReplyBase(id, bs);
        }
コード例 #3
0
        /// <summary>
        /// 发送数据到wsserver
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="type"></param>
        public void Send(byte[] msg, WSProtocalType type = WSProtocalType.Text)
        {
            var data = new WSProtocal(type, msg).ToBytes();

            base.Send(data);
        }
コード例 #4
0
ファイル: WSSServerImpl.cs プロジェクト: xwyangjshb/SAEA
        private void ReplyBase(Stream stream, WSProtocalType type, byte[] content)
        {
            var byts = new WSProtocal(type, content).ToBytes();

            stream.Write(byts, 0, byts.Length);
        }
コード例 #5
0
        private void ReplyBase(WSUserToken ut, WSProtocalType type, byte[] content)
        {
            var byts = new WSProtocal(type, content).ToBytes();

            base.SendAsync(ut.ID, byts);
        }
コード例 #6
0
        private void ReplyBase(string id, WSProtocalType type, byte[] content)
        {
            var byts = new WSProtocal(type, content).ToBytes();

            _server.SendAsync(id, byts);
        }
コード例 #7
0
        /// <summary>
        /// 发送数据到wsserver
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="type"></param>
        public void Send(byte[] msg, WSProtocalType type = WSProtocalType.Text)
        {
            var data = new WSProtocal(type, msg).ToBytes();

            _client.SendAsync(data);
        }