TCPSocket ports and firewalls

I have written a data logger program that runs as a service and two programs that communicate with it through TCPSockets. The desktop app never seems to have a problem, but the web app has intermittent problems. Recently, it stopped working altogether with the TCP Socket unable to connect. I was running Kaspersky Internet Security and turning off all the options didn’t help, but uninstalling Kapersky did. I had previously set the Kapersky firewall to allow the port I set when I open the connection , but it appears the ServerSocket in the data logger handed the connection off to another port that Kapersky was blocking. I have no idea why it always worked with the desktop app and failed so often with the web app. It there a way to limit the ports available to the TCPSockets and ServerSockets so all ports don’t have to be unsecured? I can imagine this is going to be a big issue as most of my users are not IT professionals (Firewall, What;s that?).

Typically, firewalls don’t behave like that. You should be able to open just the main port and when it gets handed off, the rest of the connection/packets are considered established or related and are also allowed through. You DO need to have an incoming port open for the initial connection though.

I had the port open in Kapersky (it came free with the computer) and had all sorts of trouble. There is no problem with the Windows firewall. I think I’ll go back to Norton or Avast. I haven’t had problems with either in the past.