コード例 #1
0
 private void InitializeClient()
 {
     if (_client != null)
     {
         _client?.Close();
         _client?.Dispose();
     }
     _client = new OscSender(IPAddress.Any, IPAddress.Loopback, _sys.Config.RequestPort);
     _client.Connect();
 }
コード例 #2
0
        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();
        }
コード例 #3
0
 public override void DestroyNetwork()
 {
     if (sender != null)
     {
         sender.Close();
     }
 }
コード例 #4
0
        /// <summary>
        /// Stops the synchronisation service.
        /// </summary>
        public void Stop()
        {
            shouldExit = true;

            threadExited.WaitOne();

            sender.Close();
        }
コード例 #5
0
        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());
            }
        }
コード例 #6
0
 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();
     }
 }
コード例 #7
0
ファイル: OSCClient.cs プロジェクト: murrrkle/TILS
 public void Dispose()
 {
     if (!_isDisposed)
     {
         _isDisposed = true;
         _sender.Close();
         _sender.Dispose();
         _reciever.Close();
         _reciever.Dispose();
     }
 }
コード例 #8
0
 //受信待受停止
 public void Dispose()
 {
     //待受停止
     try
     {
         oscReceiver?.Close();
         oscSender?.Close();
     }
     finally
     {
         //Thread終了を1500msの間待機
         thread?.Join(1500);
     }
 }
コード例 #9
0
 public void Dispose()
 {
     oscSender.Close();
 }
コード例 #10
0
 private void HandleShutdown()
 {
     kinectHandler?.Close();
     oscSender?.Close();
 }
コード例 #11
0
 public void StopDataOut()
 {
     _sender.Close();
 }
コード例 #12
0
 public void Shutdown()
 {
     sender.Close();
     sender.Dispose();
 }
        public override void Close()
        {
            try { oscReceiver.Close(); } catch { }

            try { oscSender.Close(); } catch { }
        }