TWS connects to our servers via ports 4000 and 4001; it will not function on any other port. To use TWS from behind a firewall, users should download the standalone version, and will be prompted during installation to specify proxy settings that will be used by TWS for all http requests.
What protocols and ports should my Broadband ISP allow?
Powered by IBot
How to check and solve connectivity issues affecting TWS?
Host and Ports Documentation
TWS/IB Gateway and their interaction with proxy servers
Why can I not log in to Trader Workstation (TWS) due to failed "login attempts"?