Пример #1
0
        private void Rcv2_OnComplete(DataReciver send, byte[] buffer, int index, int count)
        {
            clientConfig.TransportToService         = new TransportToService();
            clientConfig.TransportToService.MsgID   = msgID;
            clientConfig.TransportToService.Content = new Coder(Coder.EncodingMothord.UTF8).GetEncodingString(buffer, count);
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(clientConfig);

            byte[] newBuffer = new Coder(Coder.EncodingMothord.UTF8).GetEncodingBytes(json);
            m_sockt1.Send(newBuffer, index, newBuffer.Length, SocketFlags.None);
            clientConfig.TransportToService = null;

            //m_sockt1.Send(buffer, index, count, SocketFlags.None);
            send.ReciveOne();
        }
Пример #2
0
        public void StartSwap()
        {
            m_swaping = true;

            var rcv1 = new DataReciver(m_sockt1);

            rcv1.OnComplete += Rcv1_OnComplete;
            rcv1.ReciveOne();

            var rcv2 = new DataReciver(m_sockt2);

            rcv2.OnComplete += Rcv2_OnComplete;
            rcv2.ReciveOne();
        }
Пример #3
0
 private void Rcv1_OnComplete(DataReciver send, byte[] buffer, int index, int count)
 {
     m_sockt2.Send(buffer, index, count, SocketFlags.None);
     send.ReciveOne();
 }