Very mysterious socket behaviour
-
Imagine the following scenario: One of my applications communicates with another (3rd party, non open source) application via a simple TCP socket. The socket is only used to retrieve the status of the other app (or better, the other app sends its status over the socket). The packets are small, usually below 70 bytes, but they are sent pretty often (about 3-5 times per second). After my app receives a packet from the other app, it sends a small, 33 byte answer. After this answer, the other app sends a new status packet and so on. So much for the scenario... Now there are two odd things going on. The first oddity is a packet of 1024 bytes. This packet is mysteriously received by the other app, but I have no idea where this might come from (I'm using Port explorer, and it says that it should come from my app, but that's impossible). The packet arrives shortly after I've sent my "answer" to the other app. It contains my answer plus a lot of garbage. But that's not all... After a while, the other app stops sending out its status to my app. But! It begins to receive even more of these 1024 byte packets - with the correct status at the beginning! Port explorer still says that all comes from my app, but that's totally impossible (I couldn't even guess the correct status). So, where might these packets come from? What might make the other app stop sending out its status? Is there a way to get these 1024 byte packets?
-
Imagine the following scenario: One of my applications communicates with another (3rd party, non open source) application via a simple TCP socket. The socket is only used to retrieve the status of the other app (or better, the other app sends its status over the socket). The packets are small, usually below 70 bytes, but they are sent pretty often (about 3-5 times per second). After my app receives a packet from the other app, it sends a small, 33 byte answer. After this answer, the other app sends a new status packet and so on. So much for the scenario... Now there are two odd things going on. The first oddity is a packet of 1024 bytes. This packet is mysteriously received by the other app, but I have no idea where this might come from (I'm using Port explorer, and it says that it should come from my app, but that's impossible). The packet arrives shortly after I've sent my "answer" to the other app. It contains my answer plus a lot of garbage. But that's not all... After a while, the other app stops sending out its status to my app. But! It begins to receive even more of these 1024 byte packets - with the correct status at the beginning! Port explorer still says that all comes from my app, but that's totally impossible (I couldn't even guess the correct status). So, where might these packets come from? What might make the other app stop sending out its status? Is there a way to get these 1024 byte packets?
Hi! If you can post some of the code snippets, then there might a chance for a solution. At the moment it seems that you are allocating the buffer of size 1024, and fill in the first few bytes ans send it. Rest is garbage. And btw what kind of sockets you are using? Sync or Async etc. Regards, Bilal Anjum
-
Hi! If you can post some of the code snippets, then there might a chance for a solution. At the moment it seems that you are allocating the buffer of size 1024, and fill in the first few bytes ans send it. Rest is garbage. And btw what kind of sockets you are using? Sync or Async etc. Regards, Bilal Anjum
No, your assumptions are wrong. My buffer is not 1024, and I am not sending it (as I stated, I CANNOT send it, I can't guess the contents of these packets). It is not that simple. The socket on my side is async, but that doesn't matter. I can't say what kind of socket the other program is using (I don't think that they use MFC at all). And code snippets won't help - it's a simple derivated socket which receives stuff and sends a small reply (and this reply does not contain garbage, nor is it 1024 bytes long). I can only say that these packages cannot come from my app. I neither can guess the contents of them (that would solve my problems, lol), nor do I send anything at that time (I only send sth. when I receive sth., and as I stated, I don't receive anything after a while... and even if I don't send anything at all these 1024 byte packages arrive at the other app).