private void BroadcastTimerOnElapsed(object arg) { UdpManager tempUdpManager = UdpManager.GetInstance(); tempUdpManager.Send(IPAddress.Broadcast, BroadcastPort, contentTcp); tempUdpManager.Send(IPAddress.Broadcast, BroadcastPort, contentUdp); }
public void Start() { UdpManager tempUdpManager = UdpManager.GetInstance(); _udpClient = new UdpClient(new IPEndPoint(tempUdpManager.HostIpAddress, receiveImgPort)); _udpClient.Client.ReceiveBufferSize = 10000000; _receiveThread = new Thread(Receive); _receiveThread.IsBackground = true; _receiveThread.Start(); }
public void Init() { //Set the local UDP port UdpManager tempUdpManager = UdpManager.GetInstance(); tempUdpManager.InitUdp(localPort, UdpReceiveCommand); //Generate the broadcast info _contentTcp = ("Server" + Separator + tempUdpManager.HostIpAddress + Separator + TcpServer.GetInstance().ServerPort + Separator + Environment.NewLine); //Set the timer TimerManager tempTimerManager = TimerManager.GetInstance(); _timerGuid = tempTimerManager.AddTimer(BroadcastTimerOnElapsed, null, 0, 1000); }
static void Main(string[] args) { #region Camera RaspberryCamera tempCamera = RaspberryCamera.GetInstance(); tempCamera.StartStreaming(pictureSize, fps); Console.WriteLine("Init Camera --- success"); #endregion #region Init UDP manager Console.Write("Init UDP manager"); UdpManager tempUdpManager = UdpManager.GetInstance(); tempUdpManager.InitUdp(LocalUdpPort, InterNetwork.UdpListenTaskDelegate); Console.WriteLine(" --- success"); #endregion #region Init Serial Manager Console.Write("Init SERIAL manager "); SerialManager tempSerialManager = SerialManager.GetInstance(); while (true) { string[] ports = SerialManager.GetAllVaildPorts(); bool signFind = false; foreach (string i in ports) { if (i.Contains("USB")) { SerialManager.SerialPortWithGuid portWithGuid = tempSerialManager.Add(i, BaudRate, Parity.None, RaspberrySerial.TargetDataReceivedEventHandler); RaspberrySerial.PortGuid = portWithGuid.Guid; RaspberrySerial.StartReceive(portWithGuid.Serial); Console.Write("Select" + i); signFind = true; break; } } if (!signFind) { Console.WriteLine("The system is waiting for a serial port device"); Thread.Sleep(1000); } else { break; } } Console.WriteLine(" --- success"); #endregion if (Debugger.IsAttached) { while (true) { Thread.Sleep(1000); } } Console.ReadLine(); tempCamera.StopStreaming(); StateManager.GetInstance().FindServer = false; tempSerialManager.GetPort(RaspberrySerial.PortGuid).Serial.Dispose(); Environment.Exit(0); }
public void BroadcastToInterNetwork(string data) { UdpManager tempUdpManager = UdpManager.GetInstance(); tempUdpManager.Send(IPAddress.Broadcast, BroadcastPort, data); }