Avast eating packets between applications

Recently I started working on a new application for myself, a tool to synchronize my music library across all the PCs in my LAN.

I made the design very simple, have a central server running with a database of all the songs so a client could connect and request files or upload new ones to make the library complete on that PC.
This was my first time attempting to make a server application so I had some difficulty trying to get some things to work, but one bug really stood out and it was quite hard to track down. For testing, when a client would connect to the server it would send the byte &H56, which is the same as the ASCII character “V”. After the server receives this I made it so it would then return &H56 plus a two-byte version string.

What I couldn’t understand was when the client would connect nothing would happen. The server wouldn’t receive the byte and therefore the client got nothing back, and after closing the client the CPU usage would go to 50-100% and stay there for a few minutes. The server would then stay frozen so it wouldn’t accept any request/connections and wouldn’t even recognize that the client had disconnected. I then tried connecting with PuTTY on a raw connection and typing “V” then sending it. Sure enough the server responds with a version string like I wanted.

I spent a long time trying to debug this but couldn’t find the issue. Eventually I noticed it wasn’t actually my server hogging all the CPU power when the client disconnected, it was the process “AvastSvc.exe”. So I then disabled all the Avast shields and tried running the server again.

As soon as the client connected it send the byte and received the string back from the server. You couldn’t even notice a delay, and when closing the client connection, there was no spike in CPU usage and the server wouldn’t freeze up like before.

So I’d like to know why Avast is jacking the connection between the two applications, eating all the packets, and then eating up all my CPU power when I attempt to close a socket on the client side.

I’d also like to note, when I first tried these tests I was running everything off port 987, but after realizing Avast was causing the issues switched to port 2047 and then port 80 but no matter what I tried it always ends with the same issues.