Exemplo n.º 1
0
 /// <summary>
 /// Closes the connection
 /// </summary>
 public virtual void Close()
 {
     if (socket != null)
     {
         socket.Close();
         socket = null;
     }
 }
Exemplo n.º 2
0
        /// <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;
            }
        }