C
cerr
hi There,
I have a piece of code in C and wanted to write a little simulator for
it in Perl. I basically wanna be listening on port 16001 and on
reception i wanna send back an acknowledgement "POK\0". I thought I
got this accomplished but for some reason my client doesn't seem to
understand the acknowledge string.
What I got in perl:
while (1){
my $client = $prssock->accept();
print "Got client\n";
while(<$client>) {
print "$_\n";
$prgstr.=$_;
print $client "POK";
print "POK\n";
}
print "lost client!\n";
}
and in C:
rc = write(_prg->prg_bus.bus_sock, response, strlen(response)); //
where response = "POK\0"
I'm not sure what I'm doing wrong here... Any suggestions? Would it
be because of the null character? I don't think so, eh?
The client side just checks if "POK" exists in the received
string...and for some reason it can't see the one coming back from my
perl script.... that puzzles me..
Thanks,
I have a piece of code in C and wanted to write a little simulator for
it in Perl. I basically wanna be listening on port 16001 and on
reception i wanna send back an acknowledgement "POK\0". I thought I
got this accomplished but for some reason my client doesn't seem to
understand the acknowledge string.
What I got in perl:
while (1){
my $client = $prssock->accept();
print "Got client\n";
while(<$client>) {
print "$_\n";
$prgstr.=$_;
print $client "POK";
print "POK\n";
}
print "lost client!\n";
}
and in C:
rc = write(_prg->prg_bus.bus_sock, response, strlen(response)); //
where response = "POK\0"
I'm not sure what I'm doing wrong here... Any suggestions? Would it
be because of the null character? I don't think so, eh?
The client side just checks if "POK" exists in the received
string...and for some reason it can't see the one coming back from my
perl script.... that puzzles me..
Thanks,