Пример #1
0
 public ASyncToken(SocketAsyncEventArgs asynca, CloudServer server, int MaxBuffsize)
 {
     this.Asyn      = asynca;
     Stream         = new ZYNetRingBufferPool(MaxBuffsize);
     CurrentServer  = server;
     this.dataExtra = server.EcodeingHandler;
     sendobj        = new AsyncSend(asynca.AcceptSocket);
 }
Пример #2
0
        private static void EventManager_Receive(AsyncUserToken asyncUserToken)
        {
            byte[] buffer = new byte[asyncUserToken.ReceiveBuffer.DataCount];
            Array.Copy(asyncUserToken.ReceiveBuffer.Buffer, 0, buffer, 0, buffer.Length);
            string info = System.Text.Encoding.UTF8.GetString(buffer);

            asyncUserToken.ReceiveBuffer.Clear();

            Console.WriteLine(string.Format("接收到的消息:{0}", info));
            AsyncSend.Send(asyncUserToken.SendEventArgs, System.Text.Encoding.UTF8.GetBytes("hello,my .net core."));
        }
Пример #3
0
        /// <summary>
        /// 发送数据
        /// </summary>
        /// <param name="bs"></param>
        public void Send(byte[] bs)
        {
            if (!m_serialPort.IsOpen)
            {
                throw new SerialPortException("不能在串口关闭状态发送数据");
            }
            //异步发送
            AsyncSend call = new AsyncSend(DoAsyncSend);

            call.BeginInvoke(bs, null, null);
        }
Пример #4
0
        public void Send(byte[] bs)
        {
            if (!m_SerialPort.IsOpen)
            {
                return;
                //throw new SerialPortException("不能在串口关闭状态发送数据");
            }

            //异步发送
            AsyncSend call = new AsyncSend(DoAsyncSend);

            call.BeginInvoke(bs, null, null);
            //bs = null;
            //GC.Collect();
            //GC.WaitForPendingFinalizers();
        }
Пример #5
0
 public void AsyncSendPrintData(EntityBase masterData, Boolean isOrder)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendPrintData);
     asyncSend.BeginInvoke(masterData, isOrder, null, null);
 }
Пример #6
0
 public void AsyncSendEmail(string subject, string body, string mailTo, string replayTo, MailPriority mailPriority)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendEmail);
     asyncSend.BeginInvoke(subject, body, mailTo, replayTo, mailPriority, null, null);
 }
Пример #7
0
 /// <summary>
 /// Begins sending a mail asynchronously
 /// </summary>
 /// <param name="mail">Mail Message to send</param>
 /// <param name="callback">Callback method</param>
 /// <param name="inReplyTo">The id the of the mail which we are responding to</param>
 public IAsyncResult BeginSending(MailSoap12TransportBinding mail, string inReplyTo, AsyncCallback callback)
 {
     _asyncSend = new AsyncSend(Send);
     return(_asyncSend.BeginInvoke(mail, inReplyTo, callback, _asyncSend));
 }
Пример #8
0
 public void AsyncSendPrintData(IpMaster ipMaster)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendPrintData);
     asyncSend.BeginInvoke(ipMaster, null, null);
 }
Пример #9
0
 public void AsyncSendPrintData(PickListMaster pickListMaster)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendPrintData);
     asyncSend.BeginInvoke(pickListMaster, null, null);
 }
Пример #10
0
 public void AsyncSendPrintData(com.Sconit.Entity.EntityBase masterData)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendPrintData);
     asyncSend.BeginInvoke(masterData, null, null);
 }
Пример #11
0
 public void AsyncSendMessage(string[] phones, string content)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendMessage);
     asyncSend.BeginInvoke(phones, content, null, null);
 }
Пример #12
0
 public void AsyncSendPrintData(Hu hu)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendPrintData);
     asyncSend.BeginInvoke(hu, null, null);
 }
Пример #13
0
 public void AsyncSendPrintData(ReceiptMaster receiptMaster)
 {
     AsyncSend asyncSend = new AsyncSend(this.SendPrintData);
     asyncSend.BeginInvoke(receiptMaster, null, null);
 }