Here is the entire subroutine that handles the telemetry. It is a rapid update, I think it sends an XML every second or so, basically one after another.
sub telemetry { $SIG{PIPE} = "IGNORE"; $\="\n"; my $img = '"uas.png"'; my $post_time; my $test; my $xs = XML::Simple->new( RootName=>'Telemetry'); my $check = 0; while(1){ goto END if $die == 1; if ($tele_start == 1){ my $tele_client = IO::Socket::INET->new( PeerAddr => $node + ) or $error = 3; if ($tele_client){ for(;;){ $telemetry = 1; print "@@@ started @@@"; print "*** Recv UA ***"; $tele_client->recv($test, 1599); print $test; #use bytes; print "bytes: ",length($test); print "Reading in XML"; #if (length $test <= 700){ my $uasdata = $xs->XMLin($test); print "XML Loaded!"; if ("$uasdata->{VehicleID}" eq 'Velocity' and defi +ned $uasdata){ #Open Placefile open UASPF,'>',"uaspf.txt.bak" or die "Cannot +Open File uavpf.txt.bak!"; #open UASPF,'>',"/home/uas/public_html/uas/uas +pf.txt.bak" or die "Cannot Open File uavpf.txt.bak!"; #&ctime; my @time = gmtime; my $hour = $time[2]; my $min = $time[1]; my $sec = $time[0]; $hour = "0$time[2]" if $time[2] < 10; $min = "0$time[1]" if $time[1] < 10; $sec = "0$time[0]" if $time[0] < 10; $post_time = "($hour:$min:$sec)"; #print placefile elements print UASPF "Title: UAS GPS Position"; print UASPF "Threshold: 999"; print UASPF "RefreshSeconds: 2"; print UASPF "Iconfile: 1, 22, 21, 10, 14, $img +\n"; print UASPF "Icon: $uasdata->{GPS}->{Latitude} +, $uasdata->{GPS}->{Longitude}, $uasdata->{GPS}->{Heading}, 1, 1, $po +st_time Latitude: $uasdata->{GPS}->{Latitude} Longitude: $uasdata->{G +PS}->{Longitude} Heading: $uasdata->{GPS}->{Heading} Speed: $uasdata- +>{AirData}->{TrueAirSpeed} cm/s"; close UASPF; #rename("/home/uas/public_html/uas/uaspf.txt.b +ak", "/home/uas/public_html/uas/uaspf.txt") or print "Cannot rename f +ile!";# and $log->error($!); rename("uaspf.txt.bak", "uaspf.txt") or die"Un +able to replace: $!"; print "*** UA Done ***"; } #} goto END if $die == 1; last if $tele_start == 0; } undef $tele_client; }else { $telemetry = 0}; print "SLEEP"; sleep 5; } else {sleep 1}; } END: }

In reply to Re^2: XML not reading fully during IO::Socket receive by deadpickle
in thread XML not reading fully during IO::Socket receive by deadpickle

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.