public bool CreateChannelUDP() { bool ok = false; try { Dictionary <String, String> rep = _comm.SendCommand(PepperlCmd.CreateChannelUDP, PepperlConst.ParamUdpAddress, FindMyIP().ToString(), PepperlConst.ParamUdpPort, _port.ToString(), PepperlConst.ParamUdpWatchdog, PepperlConst.ValueUdpWatchdogOn, PepperlConst.ParamUdpWatchdogTimeout, _timeout.TotalMilliseconds.ToString(), PepperlConst.ParamUdpPacketType, PepperlConst.ValueUdpPacketTypeDistanceAmplitudeCompact); if (rep != null) { _handle = rep[PepperlConst.ParamUdpHandle]; if (_handle != "") { _udp = new UDPConnection(); _udp.Connect(_ip, _port, _port + 1); _udp.StartReception(); _udp.FrameReceived += _udp_FrameReceived; _comm.SendCommand(PepperlCmd.ScanStart, PepperlConst.ParamUdpHandle, _handle); ok = true; } } } catch (Exception) { ok = false; if (_udp != null && _udp.Connected) { _udp.Close(); _udp = null; } } return(ok); }