private bool Reconnect() { m_is_connected = false; m_may_send.Reset(); if (m_port == null) { return(false); } try { m_port.Close(); } catch { } try { m_port.Open(); } catch { return(false); } //connect procedure if (m_is_server) { ////wait for greeting //if (!WaitForGreeting(-1)) //{ // Trace.WriteLine("Garbage Greeting", null); // return false; //} //if (StateLogging) // Trace.WriteLine("Got Greeting", null); ////request connection //SendFrame(BacnetPtpFrameTypes.FRAME_TYPE_CONNECT_REQUEST); } else { //send greeting SendGreeting(); } m_is_connected = true; return(true); }
private bool Reconnect() { _isConnected = false; _maySend.Reset(); if (_port == null) { return(false); } try { _port.Close(); } catch { } try { _port.Open(); } catch { return(false); } //connect procedure if (_isServer) { ////wait for greeting //if (!WaitForGreeting(-1)) //{ // Log.Debug("Garbage Greeting"); // return false; //} //if (StateLogging) // Log.Debug("Got Greeting"); ////request connection //SendFrame(BacnetPtpFrameTypes.FRAME_TYPE_CONNECT_REQUEST); } else { //send greeting SendGreeting(); } _isConnected = true; return(true); }
public void Dispose() { if (m_port != null) { try { m_port.Close(); } catch { } m_port = null; } }
public void Dispose() { _port?.Close(); _port = null; }
public override void Dispose() { _port?.Close(); _port = null; }