saeen has asked for the wisdom of the Perl Monks concerning the following question:
But when i try to telnet to port 8080 it does not work. I have SSH running on the same machine and telnet to port 22 works fine. If i try to telnet port 8080 from local host it works. Any suggestions ?#!/usr/bin/perl -w use strict; use warnings; use IO::Socket::INET; my $sock = ''; startListening(); sub startListening(){ $sock = new IO::Socket::INET( LocalPort => '8080',Porto => 'tcp',Liste +n => '1', Reuse => '1') or die "Could not create socket \n" unless $sock; my $new_sock = $sock->accept() or die "Lost connection\n"; if ($new_sock){ print "Received incoming connection on port \n"; #close ($new_sock); close($sock); exit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket not accepting connection
by MidLifeXis (Monsignor) on Mar 18, 2012 at 10:32 UTC | |
|
Re: Socket not accepting connection
by Corion (Patriarch) on Mar 18, 2012 at 10:39 UTC | |
by MidLifeXis (Monsignor) on Mar 18, 2012 at 11:00 UTC | |
|
Re: Socket not accepting connection
by NetWallah (Canon) on Mar 18, 2012 at 16:39 UTC | |
|
Re: Socket not accepting connection
by tobyink (Canon) on Mar 18, 2012 at 20:35 UTC | |
by saeen (Novice) on Mar 21, 2012 at 00:43 UTC |