in reply to Trouble with sockets

I had the same problem. It turned out that I had firewalls on both machines that prevented my two programs from communicating.

Replies are listed 'Best First'.
Re^2: Trouble with sockets
by sweetblood (Prior) on Jun 21, 2004 at 14:49 UTC
    Both machines are on the same network and not behind any firewalls. I can connect to and from these machines using other protocols such as telnet, ftp, UNC, etc. I think the problem is with the winnt4 machine running the server code, since I don't see a connection using netstat -a. I believe I should see an entry for that port listed as 'Listening'.

    Thanks!

    Sweetblood

      My machines were both in the same room, on the same router and subnet. Firewall software on both machines (Linux and OS X) prevented the connection.

      This code will give you a functional server you can telnet into. Don't use it for anything but testing:

      #!/usr/bin/perl -w use strict; use IO::Socket; my $sock = IO::Socket::INET->new( Listen => 1, LocalAddr => 'localhost', LocalPort => 9000, ) || die "Unable to create socket: $!\n"; print "Waiting for message...\n"; while ( my $fh = $sock->accept()) { print while <$fh>; } close ($sock);

      cheers

      tachyon