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."
+);
}
}
}