示例#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);
        }
示例#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);
        }
示例#3
0
 /// <summary>
 /// 发送信息
 /// </summary>
 /// <param name="data">数据</param>
 /// <param name="remoteIp">远程主机IP</param>
 public void Send(byte[] data)
 {
     UdpLibrary.Send(data, RemoteEp);
 }
示例#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);
        }
示例#5
0
 /// <summary>
 /// 关闭监听
 /// </summary>
 public void Stop()
 {
     UdpLibrary.Stop();
 }
示例#6
0
 /// <summary>
 /// 启动监听
 /// </summary>
 public void Start()
 {
     UdpLibrary.Start();
 }