protected void connect() { client.eConnect(ip_add, return_port, return_clientId); try { while (!client.isConnected()) ; q.offer( "Connected to TWS server version " + client.serverVersion() + " at " + client.TwsConnectionTime()); } catch (Exception e) { q.offer("EXCEPTION while connecting: " + e.getMessage()); } }
protected boolean check_connection() { return client.isConnected(); }
public void disconnect() { if (clientSocket.isConnected()) { clientSocket.eDisconnect(); connected = false; } }