Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
I am in the process of writing a server that will accept an xml file, parse it, then send a response back based on the file.

I have successfully written the Server and a mock Client in Perl which communicate wonderfully through a tcp connection on port 80. The problem is, when the actual client connects using their client app, it passes a POST header which the server takes in but it stops responding when the xml data is passed.

At this point I want to take in all the information from the client request. I have a packet sniffer open and it's showing me the POST request which the server accepts and writes. After that, the sniffer shows a continuation which holds the XML data from the client. The server stops after printing the Header POST, and no XML is printed.

use IO::Socket; $local = IO::Socket::INET->new( Proto => 'tcp', LocalAddr => '192.168.150.131:80', Reuse => 1 ) or die "$!"; $local->listen(); print "Awaiting client...\n"; my $addr; while ($addr = $local->accept() ) { print "Connecting from: ", $addr->peerhost(); print " Port: ", $addr->peerport(), "\n"; while (<$addr>) { print "Client: $_"; } close $addr; # close client print "Idle...\n"; }


Any suggestions would be greatly appreciated.

Thank you,
DWW

In reply to Problems accepting client data by dwatson06

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.