On Tue, 1 Oct 2002 21:56:31 -0700 (PDT), [EMAIL PROTECTED] (Patricia
Hinman) wrote:

>Hi everyone,
>
>It's my first day studying sockets.  I'm having
>trouble getting the script on my server to initialize
>itself because I don't have a shell account for my
>website.  Can I initialize the Socket on the server
>side from a cgi script on my machine?
>
>Here's my code.

Probably not. If you have an account on a remote server for
web page hosting, then they probably block you from opening
ports. Write an email to your sysadmin if you really
need to do this. On a remote server, with maybe a thousand or more
users, everyone would be constantly fighting over ports to use.

If you just want to practice with the script, use you own machine.
LocalHost => 'localhost'
or you will need to find someone who will give you a real user
account on their machine.

>
>#!/usr/bin/perl
>BEGIN{open(STDERR,">>./errsocket.txt");}
>use CGI header;
>print header;
>use IO::Socket;
>$sock = new IO::Socket::INET (
>       LocalHost => 'www.websiteprogrammin.com',
>       LocalPort => 1200,
>       Proto     => 'tcp',
>       Listen    => 5,
>       Reuse     => 1                             
>       );
>print "Socket could not be created. 
>       Reason: $!" unless $sock;
>open (FILE, ">$file") || 
> print "\nCouldn't open $file to write socket
>input.$!";
>while ($new_sock = $sock->accept()) {
>    while (defined ($buf = <$new_sock>)) {
>       print FILE $buf;
>    }
>}
>close ($sock);
>close (FILE);
>
>
>__________________________________________________
>Do you Yahoo!?
>New DSL Internet Access from SBC & Yahoo!
>http://sbc.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to