sajanagr has asked for the wisdom of the Perl Monks concerning the following question:
I posted 2-3 days back with my xinetd service giving me error -
Address already in use at ./server.pl line 32.
I was suggested to use flag = REUSE in xinetd service and it did work fine. Now, the error has recreated and I don't the reason why. Need some pointers here.
my xinetd service
Part of my server.pl code -# default: on # description: Hello World socket server service sajan { socket_type = stream flags = REUSE wait = no user = root server = /tmp/server.pl log_on_success += USERID log_on_failure += USERID disable = no }
i have entry in /etc/services as - sajan 7890/tcp#!/usr/bin/perl -w # server1.pl - a simple server use strict; use Socket; use IO::Socket; use constant TCP_PORT => 7890; my $port = TCP_PORT; my $proto = getprotobyname('tcp'); sub logmsg { print "$0 $$: @_ at ", scalar localtime, "\n" } # create a socket, make it reusable socket(SERVER, PF_INET, SOCK_STREAM, $proto) or die "socket failed : $ +!\n"; setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1) or die "setsock faile +d : $! \n"; # grab a port on this machine my $paddr = sockaddr_in($port, INADDR_ANY); # bind to a port, then listen bind(SERVER, $paddr) or die "bind failed : $!"; listen(SERVER, SOMAXCONN) or die "listen failed : $!"; print "Server started on port $port \n";
Need help to understand and resolve this. Thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Address Bind issue reincarnation
by almut (Canon) on Jul 15, 2010 at 13:42 UTC | |
by sajanagr (Acolyte) on Jul 16, 2010 at 05:43 UTC | |
by almut (Canon) on Jul 16, 2010 at 06:25 UTC | |
by sajanagr (Acolyte) on Jul 19, 2010 at 05:43 UTC | |
by almut (Canon) on Jul 19, 2010 at 09:38 UTC | |
| |
|
Re: Address Bind issue reincarnation
by sierpinski (Chaplain) on Jul 15, 2010 at 12:52 UTC | |
by sajanagr (Acolyte) on Jul 16, 2010 at 05:39 UTC |