I have written a test suite however now that i am trying to multithread the windows client (as it is used to establish multiple connections to test servers at the same time) all my data communications are failing to get back to the server. I think i have narrowed it down to the autoflush setting, any ideas? (it worked before multi-threading).
Client (send):
sub sendxml {
#THREAD
while (my $xml = $g_sendxmlQueue->dequeue) {
my $xs = new XML::Simple(keeproot => 1, forcearray => 1);
my $ref = $xs->XMLin($xml);
#Send results to controller
#my $ref = $_[0];
my $mhost = $ref->{job}->[0]->{controllerip};
my $mPort = 40000;
dprint(2,"sendxml: sending xml data to host [$mhost:$mPort
+]");
my $EC_SOCK = new IO::Socket::INET(PeerAddr => $mhost,
PeerPort => $mPort,
Proto => 'tcp');
if ($EC_SOCK) {
dprint(1,"Network connection established to host [
+$mhost]");
$EC_SOCK->autoflush(1);
unless ($ES_SOCK) {
dprint(1,"autoflush setting killed connect
+ion");
}
my $xml = $xs->XMLout($ref);
my @lines = split /\n/, $xml;
foreach my $line (@lines) {
print $EC_SOCK $line;
}
}
if($ref->{job}->[0]->{jname} ne "discovery" && $re
+f->{job}->[0]->{jname} ne "isalive") {
print("Sent:\n-----\n$xml\n");
}
close ($EC_SOCK);
} else {
print STDOUT "ERROR: Unable to connect to controll
+er.";
dprint(1,"ERROR: Unable to connect to controller."
+);
}
}
}
-
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.
|