Sorry, but Perl clients have no problem connecting to C servers, which is no surprise because Perl sockets functions are just extremely thin interfaces to the C socket functions.
| [reply] |
Does your 'normative perl client' only fail when trying to connect to your C server example and not your perl server example? Have you tried this? Are you using the built-in socket/connect/etc calls, or IO::Socket? Perhaps posting a short code sample would help. | [reply] |
hmmm...bad news for me then. The perl client is simple. It doesn't use IO::Socket.
#!/usr/bin/perl -w
use strict;
# simple client
use Socket;
use IO::Handle;
socket(TSOCK, PF_UNIX, SOCK_STREAM,0);
connect(TSOCK, sockaddr_un("/tmp/testsock")) or print "ERROR!";
while (defined(my $messg = <TSOCK>)) {
print $messg;
print TSOCK "Hello server!\n";
TSOCK->flush;
}
Both servers work fine with their counter-part (but I wrote them to do that). I haven't tried to change anything to debug the "c<->perl" problem, because I have a hard time understanding what could be wrong (they are just exchanging strings) and thought I would ask here to find out if there is something I'm unaware of.
If I connect the above perl client to the c server, it accepts a new connection, but it does not recieve the "Hello", and the client does not recieve messages from the server.
What could go wrong, considering the c server works fine with connections to other c programs? | [reply] [d/l] |
What string does the C server send after it accepts the connection? It does have a newline in it, right?
| [reply] |