Пример #1
0
        private void _server_OnReceive(object userToken, byte[] data)
        {
            var ut = (IUserToken)userToken;

            var up = (MyUnpacker)ut.Unpacker;

            up.Unpack(data, (package) =>
            {
                OnReceived?.Invoke(package);

                _server.SendAsync(ut.ID, up.Process(package));
            });
        }
Пример #2
0
        /// <summary>
        /// 回复
        /// </summary>
        /// <param name="userToken"></param>
        /// <param name="msg"></param>
        internal void Reply(IUserToken userToken, RSocketMsg msg)
        {
            var data = ((RUnpacker)userToken.Unpacker).Encode(msg);

            _server.SendAsync(userToken.ID, data);
        }
Пример #3
0
 public void SendData(byte[] data)
 {
     _dataSocket.Start();
     _autoResetEvent1.WaitOne();
     _dataSocket.SendAsync(_id, data);
 }
Пример #4
0
 private void _classificationBatcher_OnBatched(string id, byte[] data)
 {
     _server.SendAsync(id, data);
 }