private void InitializeClient() { if (_client != null) { _client?.Close(); _client?.Dispose(); } _client = new OscSender(IPAddress.Any, IPAddress.Loopback, _sys.Config.RequestPort); _client.Connect(); }
static void Main(string[] args) { m_Listener = new OscAddressManager(); m_Listener.Attach("/testA", TestMethodA); m_Listener.Attach("/testB", TestMethodB); m_Receiver = new OscReceiver(IPAddress.IPv6Any, IPAddress.Parse("FF02::2"), 12345); m_Sender = new OscSender(IPAddress.Parse("FF02::2"), 12345); m_Thread = new Thread(new ThreadStart(ListenLoop)); Console.WriteLine("Connecting"); m_Receiver.Connect(); m_Sender.Connect(); m_Thread.Start(); Console.WriteLine(); Console.WriteLine("Sending message to A"); Console.WriteLine(); m_Sender.Send(new OscMessage("/testA", "Hello from sender (test1)")); Thread.CurrentThread.Join(100); Console.WriteLine(); Console.WriteLine("Press any key to send the next message"); Console.ReadKey(true); Console.WriteLine(); Console.WriteLine("Sending message to B"); Console.WriteLine(); m_Sender.Send(new OscMessage("/testB", "Hello from sender (test2)")); Thread.CurrentThread.Join(100); Console.WriteLine(); Console.WriteLine("Press any key to send the next message"); Console.ReadKey(true); Console.WriteLine(); Console.WriteLine("Sending message to A and B"); Console.WriteLine(); m_Sender.Send(new OscMessage("/*", "Hello from sender (test3)")); Thread.CurrentThread.Join(100); Console.WriteLine(); Console.WriteLine("Press any key to exit"); Console.ReadKey(true); Console.WriteLine("Shutting down"); m_Receiver.Close(); m_Thread.Join(); m_Sender.Close(); }
public override void DestroyNetwork() { if (sender != null) { sender.Close(); } }
/// <summary> /// Stops the synchronisation service. /// </summary> public void Stop() { shouldExit = true; threadExited.WaitOne(); sender.Close(); }
private void OpenSender(ushort port, IPAddress ipAddress) { // Update port/IP list if (!sendPorts.Contains(port)) { sendPorts.Add(port); sendPorts.Sort(); } if (!ipAddressStrings.Contains(ipAddress.ToString())) { ipAddressStrings.Add(ipAddress.ToString()); ipAddressStrings.Sort(); } toolStripMenuItemSendPortIP.DropDownItems.Clear(); foreach (ushort p in sendPorts) { toolStripMenuItemSendPortIP.DropDownItems.Add(p.ToString()); } toolStripMenuItemSendPortIP.DropDownItems.Add("..."); toolStripMenuItemSendPortIP.DropDownItems.Add("-"); foreach (string s in ipAddressStrings) { toolStripMenuItemSendPortIP.DropDownItems.Add(s); } toolStripMenuItemSendPortIP.DropDownItems.Add("..."); // Check selected port/IP foreach (object o in toolStripMenuItemSendPortIP.DropDownItems) { if (o is ToolStripMenuItem) { ToolStripMenuItem toolStripMenuItem = (ToolStripMenuItem)o; if (toolStripMenuItem.Text == port.ToString()) { toolStripMenuItem.Checked = true; } if (toolStripMenuItem.Text == ipAddress.ToString()) { toolStripMenuItem.Checked = true; } } } // Open sender if (oscSender != null) { oscSender.Close(); } try { oscSender = new OscSender(ipAddress, port); oscSender.Connect(); } catch (Exception exception) { MessageBox.Show(exception.ToString()); } }
private void sendcommand(string s) { using (OscSender sender = new OscSender(IPAddress.Parse("192.168.1.75"), 3032)) { sender.Connect(); sender.Send(new OscMessage(s)); sender.Close(); } }
public void Dispose() { if (!_isDisposed) { _isDisposed = true; _sender.Close(); _sender.Dispose(); _reciever.Close(); _reciever.Dispose(); } }
//受信待受停止 public void Dispose() { //待受停止 try { oscReceiver?.Close(); oscSender?.Close(); } finally { //Thread終了を1500msの間待機 thread?.Join(1500); } }
public void Dispose() { oscSender.Close(); }
private void HandleShutdown() { kinectHandler?.Close(); oscSender?.Close(); }
public void StopDataOut() { _sender.Close(); }
public void Shutdown() { sender.Close(); sender.Dispose(); }
public override void Close() { try { oscReceiver.Close(); } catch { } try { oscSender.Close(); } catch { } }