Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Very mysterious socket behaviour

Very mysterious socket behaviour

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniel Tak M
    wrote on last edited by
    #1

    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?

    B 1 Reply Last reply
    0
    • D Daniel Tak M

      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?

      B Offline
      B Offline
      bilal78
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • B bilal78

        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

        D Offline
        D Offline
        Daniel Tak M
        wrote on last edited by
        #3

        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).

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups