Sending mutliple messages to a sock with mutliple return messages
-
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)
-
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)
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
-
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
-
I don't send status messages, I only send data that is required.
Regards, Gareth. (FKA gareth111)
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