Exemple #1
0
        public void SendImage(Image img)
        {
            MsgTypeCell msgTypeCell = new MsgTypeCell(MsgType.Pic, ImageHelper.ImageToBytes(img));
            MsgCell     cell        = new MsgCell(0x000010, msgTypeCell);

            UdpLibrary.Send(cell, RemoteEp);
        }
Exemple #2
0
        public void SendText(string strmsg)
        {
            byte[]      dataBytes   = Encoding.Default.GetBytes(strmsg);
            MsgTypeCell msgTypeCell = new MsgTypeCell(MsgType.TxtMsg, dataBytes);
            MsgCell     cell        = new MsgCell(0x000010, msgTypeCell);

            UdpLibrary.Send(cell, RemoteEp);
        }
Exemple #3
0
 /// <summary>
 /// 发送信息
 /// </summary>
 /// <param name="data">数据</param>
 /// <param name="remoteIp">远程主机IP</param>
 public void Send(byte[] data)
 {
     UdpLibrary.Send(data, RemoteEp);
 }
Exemple #4
0
        /// <summary>
        /// 发送信息
        /// </summary>
        /// <param name="messageId">消息标识</param>
        /// <param name="data">序列化数据</param>
        /// <param name="remoteIp">远程主机IP</param>
        public void Send(int messageId, object data, IPEndPoint remoteIp)
        {
            MsgCell cell = new MsgCell(messageId, data);

            UdpLibrary.Send(cell, remoteIp);
        }
Exemple #5
0
 /// <summary>
 /// 关闭监听
 /// </summary>
 public void Stop()
 {
     UdpLibrary.Stop();
 }
Exemple #6
0
 /// <summary>
 /// 启动监听
 /// </summary>
 public void Start()
 {
     UdpLibrary.Start();
 }