¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: API thinks it's "connected" before I granted the incoming connection request


 

Jason,

I guess this happens due to the fact that 3-way tcp connection is established prior to "Accept incoming connection attempt?" pop up, moreover on top of that it seems one can sniff the server's version along with server's (running TWS) time before getting accepted!

this is what java demo prints to std output before getting accepted:

(quote)
Server Version:76
TWS Time at connection:20160104 13:34:20 EST
(end of quote)

I'm not sure if any requests can be processed (if any) before you're accepted, I guess none. And then you have only so many seconds to click "yes" or "no" before TWS will brake established tcp-connection. (no time/desire to play with it now)

Of cause it is a very lame security model. Imho if remote IP is not on "allowed" list they should never even be able to get SYN-ACK on initial connection attempt but TWS could notify us about the fact that someone from that IP at that time tried to knock the door. Less strict would be to behave similar as they do now, but never let any info to the client before formally accepted (or found in "allowed IPs" list), but in this case someone might DDoS your production TWS.

Cheers,
Dmitry


On Mon, Jan 4, 2016 at 11:00 AM, jasonl534@... [TWSAPI] <TWSAPI@...> wrote:
?

Hi,
I'm playing around with the API and I have the following in my code (taken from

// RealTimeData.java // IB API Version 9.71 // Version 1.0 // 20141028 // R. Holowczak // Import Java utilities and Interactive Brokers API import java....
Preview by Yahoo

?

although it's failing in exactly the same way that my own code was failing before it):


?// Create a new EClientSocket object
??????????? client = new EClientSocket (this);
??????? // Connect to the TWS or IB Gateway application
??????? // Leave null for localhost
??????? // Port Number (should match TWS/IB Gateway configuration
??????? client.eConnect (null, 7496, 0);

??????? // Pause here for connection to complete
??????? try
??????? {
??????????? // Thread.sleep (1000);
??????????? while (! (client.isConnected()));
??????? }
??????? catch (Exception e)
??????? {
??????? }
??????? System.out.println("***CONNECTED***");

the last line - "CONNECTED" is being reached BEFORE I have responded to the "Accept incoming connection request" dialog box in TWS.
So, in a nutshell, the code thinks it's "connected" even though I haven't granted the connection request in TWS. The program then continues to do stuff by fails with an EOFException because it's not actually connected.

I don't understand why or how the API can think it's connected before I've granted the request.
Can anybody help me with this?
Thanks.
Jason





--
§ã §é.§Ô§Ý.§å§Ó.,
§¥§Ú§Þ§Ñ §º.



Join [email protected] to automatically receive all group messages.