lanas wrote:
Folks,
Using POE::Component::Client::TCP, I want to send several short
messages to a server. The server expects each message as a
stand-alone message so that it knows that the first byte is a command,
the second 4 four bytes a data length, etc...
But when I send 4 short messages one right after the other, the 2nd,
3rd and 4th gets bundled 'automagically' into one TCP transmission,
and this messes the server. I do not want to touch the server, which
I haven't written anyways.
So here's how I send the short messages:
$_[HEAP]->{server}->put($test1)
$_[HEAP]->{server}->put($test2)
$_[HEAP]->{server}->put($test3)
$_[HEAP]->{server}->put($test4)
Is there a way to make certain that each of these messages gets sent
on its own in a separate TCP transmission and this, without introducing
any delay ?
You probably want to look into disabling the Nagle algorithm on your
socket. Basically this means setsockopt(TCP_NODELAY) on the socket.
Within POE::Component::Client::TCP, you can get the socket handle within
the Connected event and set the option there.
Nick.
If I put a delay between eahc message then each gets sent
separately.
If I loop around ServerFlushed, sending a message each time
ServerFlushed is call, would I get the desired result ? I tried in
another setting with ClientFlushed (Component::Server::TCP) and it
still bundled the messages together in one transmission.
Any help/ideas/suggestions very much appreciated, thanks !
Al
Folks,
Using POE::Component::Client::TCP, I want to send several short
messages to a server. The server expects each message as a
stand-alone message so that it knows that the first byte is a command,
the second 4 four bytes a data length, etc...
But when I send 4 short messages one right after the other, the 2nd,
3rd and 4th gets bundled 'automagically' into one TCP transmission,
and this messes the server. I do not want to touch the server, which
I haven't written anyways.
So here's how I send the short messages:
$_[HEAP]->{server}->put($test1)
$_[HEAP]->{server}->put($test2)
$_[HEAP]->{server}->put($test3)
$_[HEAP]->{server}->put($test4)
Is there a way to make certain that each of these messages gets sent
on its own in a separate TCP transmission and this, without introducing
any delay ?
If I put a delay between eahc message then each gets sent
separately.
If I loop around ServerFlushed, sending a message each time
ServerFlushed is call, would I get the desired result ? I tried in
another setting with ClientFlushed (Component::Server::TCP) and it
still bundled the messages together in one transmission.
Any help very much appreciated, thanks !
Al