>>>>> "RN" == Ranga Nathan <[EMAIL PROTECTED]> writes:
RN> Programming. But I can not connect to this server. I get 'Connection
RN> refused!'. Am I doing something wrong here or do I need to do something to
RN> open up the port? I tried to test this using 'telnet goreliance.com 3333'.
RN> TIA.
RN> Message I get:
RN> Connecting To goreliance.com...Could not open a connection to host on port
RN> 3333
RN> : Connect failed
is this server running on that public address? if you are behind a
firewall or NAT you could have a different IP address. you can configure
those to allows incoming connections to this port.
RN> I have the following simple socket code based on page 194 of Advanced Perl
RN> use IO::Socket;
RN> $SIG{CHLD} = sub {wait ()};
RN> $main_sock = new IO::Socket::INET (
RN> LocalHost =>'208.179.25.28',
did you try using localhost (127.0.0.1)? and then connecting from the
same host?
RN> Localport => 3333,
RN> Listen => 3,
RN> Proto => 'tcp',
that is default and not needed.
RN> Reuse => 1,
i think that is now default and not needed. it used to be needed if you
would stop and restart the server all the time for debugging.
RN> while ($new_sock = $main_sock->accept()) {
RN> $pid = fork ();
RN> die "Cannot fork: $!" unless defined($pid);
RN> print "Connecting to a new client \n";
RN> if ($pid == 0) { # child process
RN> while (<$new_sock>) {
RN> print ;
RN> }
RN> exit (0);
RN> }
RN> }
that looks ok. i think your problem looks like a mismatched host address
or no access to that address.
uri
--
Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm