Beispiel #1
0
 public void disconnect()
 {
     if (sockChan != null)
     {
         sockChan.close();
     }
     sockChan         = null;
     activeConnection = false;
 }
Beispiel #2
0
        public bool connect(string hostname, int port)
        {
            if (sockChan == null)
            {
                sockChan = new SocketChannel();
            }
            else if (sockChan.isConnected())
            {
                disconnect();
            }
            sockChan.connect(hostname, port);

            return(sockChan.isConnected());
        }
Beispiel #3
0
        public bool connect(string host, int port)
        {
            if (sockChan == null)
            {
                sockChan = new SocketChannel();
            }
            else if (sockChan.isConnected())
            {
                disconnect();
                sockChan = new SocketChannel();                 // force build of new socket connection
            }
            this.host = host;
            this.port = port;
            sockChan.connect(this.host, this.port);

            return(sockChan.isConnected());
        }
Beispiel #4
0
 virtual public bool connect(string hostname, int port)
 {
     // if ( sockChan == null )
     //  {
     sockChan = new SocketChannel();
     // }
     // else if ( sockChan != null && sockChan.isConnected()) {
     //	disconnect(); // disconnect old connection
     //}
     sockChan.connect(hostname, port);
     activeConnection = sockChan.isConnected();
     if (activeConnection)         // cache the connection info
     {
         this.host = hostname;
         this.port = port;
     }
     return(activeConnection);
 }