/// <summary> /// Closes the connection /// </summary> public virtual void Close() { if (socket != null) { socket.Close(); socket = null; } }
/// <summary> /// Opens a new connection /// </summary> public virtual void Open() { try { if (socket == null) { socket = new SntpSocket() { Port = Port }; socket.NewPacket += new EventHandler <NewPacketEventArgs>(socket_NewPacket); socket.Open(NetworkAdapter); } } catch (Exception e) { Close(); throw e; } }