Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Http server hangs after connection

Status
Not open for further replies.

maskman0

Programmer
Jul 24, 2007
9
US
Hi Iam so sorry to post again ...but im stuck again...:-(

my $daemon = HTTP::Daemon->new( LocalAddr => $httpserver,
LocalPort => $httpport,
Reuse=>REUSE);

if(!defined($daemon)) {
print(
"\n\nError: Couldn't start the HTTP Server on the specifed port
$httpserver and $httpport
. \n Exiting ...!!!\n\n");
exit;
}

print("\nStarting the Unicast Server on " . "HostName=>[" . $httpserver . "] Port=>[" . $httpport . "] \n\n");


while ($connection = $daemon->accept ) {
print "***************************************************************\n";
# print "Expected ResultCode => [ $errorcode ]\n";
print scalar localtime;


This is the part of a code that I am trying to run:

The Http server starts I get following print :
"Starting the Unicast Server on " . "HostName=>[" . $httpserver . "] Port=>[" . $httpport . "]"
but after this the execution hangs & does not move forward : The line where it gets stuck is mentioned below...: How do I know that the connection has failed or can I get a print some how to debug the problem at this point stating that the connection is refused or what ever the problem is .
while ($connection = $daemon->accept )
{ print "***************************************************************\n";

Thanks & regards
 
If it just hangs, I'm not sure if there is an error being generated, but you can try the eval block to see if it captures any thing.

eval {
block of code
}; print @$;
 
Have you tried connecting to it? I don't think it will do anything until you connect to the daemon.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top