You're using POE very incorrectly. Based on the reading of your server, here's one that should do what you want. It's not tested at all, however. People in irc.perl.org #poe may be able to help you further.

#!/usr/bin/perl #use strict; # use both POE server and the filter needed use POE qw(Component::Server::TCP Filter::Stream); my $Dest = Value("DestinationXMLLocation"); my $Src = Value("SourceXMLLocation"); POE::Component::Server::TCP->new( Alias => "sum_server", Port => 11211, ClientFilter => "POE::Filter::Stream", ClientInput => sub { my ($storage, $client_input) = @_[HEAP, ARG0]; $storage->{buf} .= $client_input; # Shift the next request off the buffer. my ($req_type, $next_request, $new_buf) = parse_client_input( $storage->{buf} ); # No request yet. Wait for more input. return unless defined $next_request; # Replace the buffer with what's left. $storage->{buf} = $new_buf; if ($req_type eq "interface_levels_available") { open(FH, "<", "$Src\\interfaceLevelsAvailableResponse-OK.xml") o +r die $!; } elsif ($req_type eq "interface_level_request") { open(FH, "<", "$Src\\interfaceLevelResponse-OK.xml") or die $!; } else { warn "ignoring illegal request: $next_request\n"; return; } # Send the contents of the opened file. my $output = join("", <FH>); close(FH); $storage->{client}->put($output); }, ); sub parse_client_input { my $input_buffer = shift; # Up to you to define. # Removes one request from the beginning of $input_buffer. # Returns nothing if $input_buffer doesn't contain a complete reques +t. # Returns the new request type, the request itself, and the remains # of $input_buffer on success. # # If your protocol is line-based, use POE::Filter::Line above # instead of POE::Filter::Stream, and then don't worry about buffer # management. my $request_type = "interface_levels_available"; return($request_type, $input_buffer, ""); }

In reply to Re: POE TCP client problem by rcaputo
in thread POE TCP client problem by baldeep8

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.