private void SendChatMess(String text, IPPort ipPort)
 {
     byte[] textbyte = System.Text.Encoding.UTF8.GetBytes(text);
     byte[] sendbyte = null;
     sendbyte = new byte[] { 8, 1, (byte)ipPort.UserId }.Concat(textbyte).ToArray();
     udpProtocol.UdpSocketSend(ipPort.IP, ipPort.Port, sendbyte);
 }
Ejemplo n.º 2
0
        public void ShowViewScreenWindow(IPPort ipport)
        {
            ViewScreenWindow viewScreenWindow = ListViewScreenWindow.Where(win => { return(win.UserID == ipport.UserId); }).FirstOrDefault();

            if (viewScreenWindow == null)
            {
                udpProtocol.UdpSocketSend(ipport.IP, ipport.Port, new byte[] { 10, 1, (byte)ipport.UserId, 1 });
                viewScreenWindow = new ViewScreenWindow(ipport.UserId);
                viewScreenWindow.SetCloseAction(() =>
                {
                    ListViewScreenWindow.Remove(viewScreenWindow);
                    udpProtocol.UdpSocketSend(ipport.IP, ipport.Port, new byte[] { 10, 1, (byte)ipport.UserId, 0 });
                });

                ListViewScreenWindow.Add(viewScreenWindow);
            }

            viewScreenWindow.Show();
        }
 public void SendIPPort()
 {
     udpProtocol.UdpSocketSend(udpProtocol.serverIP, udpProtocol.serverPort, new byte[] { 3, 1 });
 }