Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Socket response splitting

by packetstormer (Monk)
on Apr 04, 2014 at 10:49 UTC ( #1081107=perlquestion: print w/ replies, xml ) Need Help??
packetstormer has asked for the wisdom of the Perl Monks concerning the following question:

Hello

I have a simple socket client that connects to a socket server and send/receives. The socket server is fairly common in the industry but has a few local variations. I have just come across one variation that seems to split the socket response over two lines, which seems strange.

Would anyone have ideas on how to combat this? Is there any IO::Socket functions to allow for this?

Thanks

Comment on Socket response splitting
Re: Socket response splitting
by BrowserUk (Pope) on Apr 04, 2014 at 11:06 UTC
    The socket server is fairly common in the industry but has a few local variations.

    Care to elaborate upon the type of socket server you are connecting to?

    I have just come across one variation that seems to split the socket response over two lines, which seems strange.

    There nothing particularly unusual about a response covering multiple lines. Think about a webserver which a single line get usually results in 100s or 1000s of lines of response. Or an ftp get which fetches whole files as the response.

    It all comes down to the specified (or just agreed) protocol for the type of server. Either the specification allows multi-line responses -- in which case your client should expect and handle them -- or it doesn't -- in which case you've found a non-complient server and should probably report the problem to the owners.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Socket response splitting
by zentara (Archbishop) on Apr 04, 2014 at 14:33 UTC
    Is sysread being used to read the socket? Sysread may read a partial line then print a newline. In other words, make sure you are using readline.

    Maybe see if autoflush is on?


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1081107]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-09-22 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (189 votes), past polls