public synchronized void eDisconnect() {
        // not connected?
        if( m_dos == null) {
            return;
        }
        
        m_connected = false;
        m_serverVersion = 0;
        m_TwsTime = "";

        DataOutputStream dos = m_dos;
        m_dos = null;

        EReader reader = m_reader;
        m_reader = null;
        
        try {
            // stop reader thread
            if( reader != null) {
                reader.interrupt();
            }
        }
        catch( Exception e) {
        }
        
        try {
            // close socket
            if( dos != null) {
                dos.close();
            }
        }
        catch( Exception e) {
        }
    }