public void SendImage(Image img) { MsgTypeCell msgTypeCell = new MsgTypeCell(MsgType.Pic, ImageHelper.ImageToBytes(img)); MsgCell cell = new MsgCell(0x000010, msgTypeCell); UdpLibrary.Send(cell, RemoteEp); }
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); }
/// <summary> /// 发送信息 /// </summary> /// <param name="data">数据</param> /// <param name="remoteIp">远程主机IP</param> public void Send(byte[] data) { UdpLibrary.Send(data, RemoteEp); }
/// <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); }
/// <summary> /// 关闭监听 /// </summary> public void Stop() { UdpLibrary.Stop(); }
/// <summary> /// 启动监听 /// </summary> public void Start() { UdpLibrary.Start(); }