Ejemplo n.º 1
0
 public void Test()
 {
     udp            = new AsyncUDP(1313, true, true, __INIT);
     udp.OnLog     += new AsyncUDP.LogHandler(LogHandler);
     udp.OnCommand += new AsyncUDP.CommandHandler(KeyHandler);
     udp.Start();
 }
Ejemplo n.º 2
0
 private void txtSendMsg_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode != Keys.Enter)
     {
         return;
     }
     string[] arr = txtSendTo.Text.Split(':');
     byte[]   buf = null;
     if (chkHexString.Checked)
     {
         buf = txtSendMsg.Text.ToByteArray();
     }
     else
     {
         buf = Encoding.Default.GetBytes(txtSendMsg.Text);
     }
     if (chkBroadcast.Checked)
     {
         AsyncUDP.Broadcast(Convert.ToInt32(arr[1]), buf);
     }
     else
     {
         _Server.SendData(new IPEndPoint(IPAddress.Parse(arr[0]), Convert.ToInt32(arr[1])), buf);
     }
     txtSendMsg.SelectAll();
 }
Ejemplo n.º 3
0
 public FAsyncUdpServer()
 {
     InitializeComponent();
     _Server = new AsyncUDP(Convert.ToInt32(txtBuffer.Text));
     _Server.DataReceived   += new EventHandler <AsyncUdpEventArgs>(Server_OnDataReceived);
     _Server.MonitorStarted += new EventHandler <AsyncUdpEventArgs>(Server_OnStarted);
     _Server.MonitorStoped  += new EventHandler <AsyncUdpEventArgs>(Server_OnShutdown);
     _Server.Exception      += new EventHandler <AsyncUdpEventArgs>(Server_OnException);
     foreach (IPAddress ipa in TcpManager.GetHostIP())
     {
         cboIP.Items.Add(ipa.ToString());
     }
 }
Ejemplo n.º 4
0
 void Start()
 {
     udp = new AsyncUDP (LISTENING_PORT, BROADCAST_PORT);
     udp.Start ();
 }