From this question:
That is a boiler-plate error message, it comes out of Windows. The underlying error code is WSAECONNABORTED. Which really doesn't mean more than "connection was aborted". You have to be a bit careful about the "your host machine" part of the phrase. In the vast majority of Windows application programs, it is indeed the host that the desktop app is connected to that aborted the connection. Usually a server somewhere else.
The roles are reversed however when you implement your own server. Now you need to read the error message as "aborted by the application at the other of the wire". Which is of course not uncommon when you implement a server, client programs that use your server are not unlikely to abort a connection for whatever reason. It can mean that a fire-wall or a proxy terminated the connection but that's not very likely since they typically would not allow the connection to be established in the first place.
It seems to me that what is happening is that the client (C#) is trying to connect to the server (PHP). The client sends a request, and then receives a response from PHP; then, on the second attempt to send a request through the same socket, attempts to send/receive data again.
Remember that PHP is a language processor that decorates the HTTP protocol, such that it basically interprets PHP code and then returns plain HTTP through the HTTP layer (Apache?) to the requester.
I am not an expert on HTTP and far from knowledgable on PHP but I would assume that this is happening because PHP is receiving your data, sending your response and then closing the connection. This would make sense because generally we do not keep sockets open in HTTP - we just fire a request, get a response and that's it.
What you are looking at doing is something called long-polling, which is where the socket for the HTTP connection stays open for a longer duration so that the server can continue to send data to the client. I do not know a whole lot about this topic but my Google-Fu leads me to SignalR, which might point you in the right direction.
In the event you aren't looking for long polling (i.e, you aren't interested in creating a socket that stays open for a long time), all you need to do is simply re-connection your socket when you write to the server if it's not already open.
This might, of course, be totally wrong. But it seems to make sense based on the phenomena and what I know about HTTP.
TLDR: You're trying to write to a connection that is already closed because HTTP (and thus PHP) only expects a single request per single response. You need to either re-connect the connection to the server or you can alternatively implement long-polling.