Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: binding server to already used port 80

by f00li5h (Chaplain)
on Jan 12, 2007 at 10:08 UTC ( [id://594339]=note: print w/replies, xml ) Need Help??


in reply to binding server to already used port 80

You'll be able to get away with running many httpd's if you use a reverse proxy, or virtual hosts....

But if the CLI you seek is a shell, via ssh or otherwise, you may be tough out of luck... as someone along the way may be transparently proxying your requests anyway...

You may be able to run your sshd on port 443, the https port (since https is not allowed to be proxied/cached)

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Replies are listed 'Best First'.
Re^2: binding server to already used port 80
by opensourcer (Monk) on Jan 12, 2007 at 10:58 UTC
    Bind Server code
    #!/usr/bin/perl use IO::Socket; sub Start { $sock = new IO::Socket::INET (LocalAddr => 'xxxx', BindPort => 80, Proto => 'tcp', Listen => 10); die "$!" unless $sock; print "Starting Xtools\n"; my $new_sock = $sock->accept(); while(<$new_sock>) { print $_; } close($sock); } Start(); 1;
    The client Code
    #!/usr/bin/perl use IO::Socket; $document = "@ARGV"; print "\n"; $EOL = "\015\012"; $BLANK = $EOL x 2; my $host = "indrmlnx02"; my $sock = new IO::Socket::INET ( PeerAddr => $host, PeerPort => http(80), Proto => 'tcp', ); #or die "Could not create socket: +$!\n" unless $sock; #print $sock "Hello there!\n"; unless ($sock) { die "cannot connect to http daemon on $host" } $sock->autoflush(1); print "-------- \n"; print $sock "hello"; #print $sock "GET $document HTTP/1.1" . $BLANK; #while ( <$sock> ) { print } close $sock; #close($sock);
    when i try the above code i get no errors, but when i stop the server and run the client i get error, cannot connect to http daemon on xxxx at xxxx.pl line xx.
    and i don't c the print's data, and no idea where it is going.

      You can’t bind to a port more than once. It’s not possible, no matter how often you ask. There’s no way to do it.

      Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://594339]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-23 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found