Then enter 127.0.0.1 as the trusted IP address.
02/01/2009 Update
Changing the configuration above sounds innocent enough. By skipping this dialog box, it saves a mouse click during development, but it seems there is an unintended side effect. Using this very simple to connect and disconnect.
require 'java' require 'TwsApi.jar' include_class 'ib.client.EClientSocket' mySocket = EClientSocket.new(self) begin mySocket.eConnect("127.0.0.1", 7496, 0) # api puts 'connected ...' mySocket.eDisconnect puts 'disconnected' rescue Exception => e puts 'can not connect' puts e.message end
Produces this error:
Server Version:43
TWS Time at connection:20090201 15:14:39 EST
connected ...
disconnected
Exception in thread "EReader" java.lang.ClassCastException: InterfaceImpl1026612999
at ib.client.EReader.eWrapper(EReader.java:47)
at ib.client.EReader.run(EReader.java:66)
What would cause this? This error is very consistent and happens at every run. So I went back and changed the trusted IP address to 127.0.0.2 to get the 'Accept incoming connection?' dialog again. The output is now as expected. No errors. So maybe this trusted IP configuration doesn't work after all :(
Server Version:43
TWS Time at connection:20090201 15:24:50 EST
connected ...
disconnected
No comments:
Post a Comment