Keyboard Shortcuts
Likes
Search
Cannot connect to Production API, test is OK.
Hi All,
I suddenly (over the weekend) cannot connect on: Call objTWSControl.m_TWSControl.Connect(connectionHost, connectionPort, clientId, False) connectionHost is blank connectionPort is correct in TWS API setup clientId is correct and unique. ONLY when trying to connect to Production. I know we've all heard it before, but (to the absolute best of my knowledge) I've changed nothing.? This code is "as is" from IB and has not been changed ever. If I simply switch (same XLS/VBA code) the connectionPort to the Test API port everything works. My app (Excel/Win7/ActiveX) just hangs on the call. Old API code, don't know version. Something changed over the weekend. Thanks, as always, and Be Well, Lou Dudka |
We have not experienced any issues on our end, Lou, but then our setup is very different. Let me throw out a few thoughts, some or all of them you may have thought about yourself already:
toggle quoted message
Show quoted text
Hope there is something here that gets you a step closer. ´³¨¹°ù²µ±ð²Ô On Tue, Jul 5, 2022 at 06:36 PM, Lou Dudka wrote:Hi All, |
´³¨¹°ù²µ±ð²Ô,
Thanks, as always, for your complete and speedy response! I'm (almost) ready to try replacing 981 with 10.12, simply because I've run out of ideas. BTW both Prod and Test are running on the same machine, so all libraries, etc are the same.? I've even taken an XLS that's successfully connected to Test and changed the port to Prod and it hangs up. ? Any yes, as you pointed out, I double checked that the Ports are correct.? If I flip between the two (Prod and Test) API setup screens in TWS, they're exactly the same, with exception of the Port, as it should be. The one thing I might try is bringing up another Prod TWS on the same machine and see if I can connect.? If I can, it would seem to point to the TWS connection itself. I don't know what Richard's "Contract Inspector" is, but if the above fails, I'll spend some time researching it. Thanks, as always, Be Well,udka Lou Dudka |
maybe firewall or antivirus updated?or changed? El mi¨¦, 6 jul 2022 a las 3:15, Lou Dudka (<loududka@...>) escribi¨®: ´³¨¹°ù²µ±ð²Ô, |
Hi All,
Fixed (cannot say "solved"). Out of desperation I changed the Prod Port from 9707 to 9777 and it connected. I then changed the Port back to 9707 and received errors. Put it back to 9777 and will proceed as if nothing happened .... I have backups of TWS from last week and if I really wanted to I could start the TWS with them.? Ah, it's just not worth the trouble ... Thanks to all, as always, Be Well, Lou Dudka |
But that sounds more like a network issue than a TWS issue, Lou.
What does your infrastructure between your client and TWS/IBGW look like? And finally, any specific reason that you do not use the IBKR standard port assignments?
|
´³¨¹°ù²µ±ð²Ô and joanmarcel119,
Again, thanks for your input. Firstly, I don't use IB's ports simply because we may (and do) run multiple TWS's on the same machine. I bought up another TWS on the same machine and tried to assign port 9707.? TWS refused it and said it was in use, which it wasn't. I ran? netstat -ano -p tcp and port 9707 did not show up. I think it's an IB problem, not a "network" problem.? It appears IB doesn't think it "let go" of the port. I'll guarantee you when I re-boot the machine this weekend and assign 9707 to the "offending" TWS it will work. This is not a big deal (now) to me since I'm up and running.? I consider myself a trader first and a technician second, but it does intrigue me. I'll keep you posted. Thanks, as always, Be Well, Lou Dudka |
Happy hunting, Lou. My gut tells me that this is not an issue? with IB or TWS. It is sufficient that some defunct process holds on to port 9707 for TWS to be denied access to that port. Those sockets in that state may not show up in netstat listings of established connections. A couple ways to check this are:
On Thu, Jul 7, 2022 at 09:00 AM, Lou Dudka wrote:
´³¨¹°ù²µ±ð²Ô and joanmarcel119, |
´³¨¹°ù²µ±ð²Ô,
?I'd first like to thank you for the time and effort you put into this site, we are very fortunate to have you. ? ?Secondly, I like to especially thank you for the same time and effort you put into this particular problem I had on this topic. Your technical knowledge is so immense it sometimes can overwhelm me.? I have 35 years professional IT experience, but I started with Mainframe IBM/Cobol.? Anything else has be self taught. ? Having said that, I re-booted the computer, bought up TWS (Prod and Test with the same port that gave me trouble) and successfully connected.? I ran "netstat -ano -p tcp " and the port showed up, as it should.? Your " lsof -iTCP -n" and "cat /proc/nettcp" would not run on Win7, though thanks for the info. ?Somewhere in the cobwebs of my aging mind I seem to remember encountering this problem before? ... . ?I have no reason to doubt your expertise so I will pay close attention to the ports that are in use and see if there is a conflict. ? ?Thanks, as always, and Be Well, ?Lou Dudka |
´³¨¹°ù²µ±ð²Ô,
OK, so Friday evening 07/08/22 I shut down everything and re-booted.? All times NYC. I brought up both test and prod TWS.? Everything went fine, as expected, and there were no port conflicts. Saturday, however, on the auto-reboot at 5:20 pm there was a port "conflict" on the test TWS this time.? I had a problem with prod last time.? "netstat -ano -p tcp " did not reveal any conflicts. I brought down the test TWS and then up again.? No conflicts.? Both running on same machine. I've been running with no conflicts ever since (Tuesday 07/12/22) with auto-reboots. I'm leaning to a problem with TWS/auto-restart, and not a "real" networking port conflict.? I've had sporadic problems with TWS not coming up clean (thread #49333) and/or hanging on auto-restarts (no port conflicts) in the past.?? I've been trying to "watch" the auto-reboot live, but like a watched teapot, it never seems to boil ... To the best of my knowledge I've changed nothing else (yeah, I know, we've all heard that one, LOL). ´³¨¹°ù²µ±ð²Ô, if I get another conflict I might take your suggestion to upgrade from 981.? I'm really short on time right now, so it would be a burden. If all else fails I'll have to hang my head in shame from Richard and re-install IBC "on the sneak" and use Scheduler ... ah, those were the days, absolutely NO problems! Thanks, as always, and Be Well, Lou Dudka |
Nothing is impossible, Lou, but my money is still on some application (real or defunct) holding the port. And it could simply be the old TWS during restart in case it does not completely terminate.
toggle quoted message
Show quoted text
Next time, use a slightly different option for the netstat command. Use "netstat -qno -p tcp" instead of "netstat -ano -p tcp"
On my Windows10 laptop, -a shows 88 ports in use, while -q shows 111 ports in use. Each port can only be used once and when some process uses 9707 as a "bound nonlistening port", TWS cannot get it as a listening port. ´³¨¹°ù²µ±ð²Ô On Tue, Jul 12, 2022 at 05:33 PM, Lou Dudka wrote:
´³¨¹°ù²µ±ð²Ô, |