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#
  4. Sending mutliple messages to a sock with mutliple return messages

Sending mutliple messages to a sock with mutliple return messages

Scheduled Pinned Locked Moved C#
javahelpquestion
4 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.
  • G Offline
    G Offline
    Gareth H
    wrote on last edited by
    #1

    I am developing a new part to a program I work on. It connects to a java process via a socket. At the moment, the user will send a message down the socket, and the Java process will return with 1 or more values. This works fine. I'd like to extend the program, so that the user could send multiple messages (sometimes 10k), thus I get into the problem of spamming the socket, and the Java process having to then reply to each message, which could return multiple messages (10 for each sometimes). Does anyone have any good ideas of how I'd make this process better? and more importantly, faster!

    Regards, Gareth. (FKA gareth111)

    E 1 Reply Last reply
    0
    • G Gareth H

      I am developing a new part to a program I work on. It connects to a java process via a socket. At the moment, the user will send a message down the socket, and the Java process will return with 1 or more values. This works fine. I'd like to extend the program, so that the user could send multiple messages (sometimes 10k), thus I get into the problem of spamming the socket, and the Java process having to then reply to each message, which could return multiple messages (10 for each sometimes). Does anyone have any good ideas of how I'd make this process better? and more importantly, faster!

      Regards, Gareth. (FKA gareth111)

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      A common error in design in sockets programming with TCP/IP sockets that I see occurring constantly are status messages being sent to verify receipt. TCP/IP is a guaranteed in order protocol. Eliminate the status messages and only send a message if requested explicitly. Furthermore, TCP keep-alive should be used and not keep alive messages.

      Need custom software developed? I do C# development and consulting all over the United States. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

      G 1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        A common error in design in sockets programming with TCP/IP sockets that I see occurring constantly are status messages being sent to verify receipt. TCP/IP is a guaranteed in order protocol. Eliminate the status messages and only send a message if requested explicitly. Furthermore, TCP keep-alive should be used and not keep alive messages.

        Need custom software developed? I do C# development and consulting all over the United States. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

        G Offline
        G Offline
        Gareth H
        wrote on last edited by
        #3

        I don't send status messages, I only send data that is required.

        Regards, Gareth. (FKA gareth111)

        E 1 Reply Last reply
        0
        • G Gareth H

          I don't send status messages, I only send data that is required.

          Regards, Gareth. (FKA gareth111)

          E Offline
          E Offline
          Ennis Ray Lynch Jr
          wrote on last edited by
          #4

          You said that the Java server is spamming you with responses. So I assumed they were unnecessary. If the responses are necessary then they are not spam and then only way to reduce them is to not send messages. Your TCP/IP stack on Windows and from within Java should both be using the Nagle Algorithm so as long as that is not disabled and you do not force a send then the best you can do is send data when you have it and request data when you need it. If you want to reduce bandwidth for streaming extremely large files you can compress the files using build in compression (see the J# library since it will have the same compression libraries as Java will have access to) or you can author your own.

          Need custom software developed? I do C# development and consulting all over the United States. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

          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