My webserver code is trying to send an image file over a TCP connection. However, the send() function is returning a -1 value with the error: Connection Reset by peer. I am using a web-browser to access the server so my guess is that the server is somehow sending the RST flag to the client which is causing the termination of connection.
I am only new to socket programming so I was wondering if you could help me understand the RST packet and how it works. How can I program the server side socket to ensure that the connection is kept alive and that the RST flag is not sent.