P
peter pilsl
I use Net:aemon for a very simple server-client-szenario
client is sending a string to the server and the server is processing
the string and returning a answerstring to the client and the client is
terminating.
Problem: the string is very long and can contain virtually any character
(its the output of freeze() from the Storable-Module which serializes
even complex hashes)
So how does the Server know when the Client has finished sending its string?
I tried several attempts that all works, but I'm sure they will fail on
certain data:
* the client sends the length of the string first, so the server knows
how much data it needs to wait for. (this will sure fail when using
utf8-encoded data and client/server will be on different machines with
different perls)
* I use a very complex "EOF"-pattern like \n\0\0\0\0\n and pray to my
gods that this pattern will never be part of the string.
I am sure that there is a much better/simple/prooved solution to this
problem that must be a standard-problem.
thnx,
peter
client is sending a string to the server and the server is processing
the string and returning a answerstring to the client and the client is
terminating.
Problem: the string is very long and can contain virtually any character
(its the output of freeze() from the Storable-Module which serializes
even complex hashes)
So how does the Server know when the Client has finished sending its string?
I tried several attempts that all works, but I'm sure they will fail on
certain data:
* the client sends the length of the string first, so the server knows
how much data it needs to wait for. (this will sure fail when using
utf8-encoded data and client/server will be on different machines with
different perls)
* I use a very complex "EOF"-pattern like \n\0\0\0\0\n and pray to my
gods that this pattern will never be part of the string.
I am sure that there is a much better/simple/prooved solution to this
problem that must be a standard-problem.
thnx,
peter