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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't create a coket

Status
Not open for further replies.

lezhik

Programmer
Oct 21, 2003
20
RU
I try to create a socket (scirpt is run on UNIX):
#!/usr/bin/perl

use Socket;

print "Content-Type: text/html\n\n";
print &quot;<html>&quot;;
print &quot;<title>Cyrus</title>&quot;;
print &quot;<head>&quot;;
print &quot;</head>&quot;;
print &quot;<body>&quot;;

$server = &quot; $port = 80;

$server_addr =(gethostbyname($server))[4];
$server_struct = pack(&quot;S n a4 x8&quot;, AF_INET, $port, $server_addr);
$proto = (getprotobyname('ftp'))[2];
socket(MYSOCK, PF_INET, SOCK_STREAM, $proto)|| print &quot;Failed to initialize socket: $!\n&quot;;
connect(MYSOCK, $server_struct) || print &quot;Failed to connect() to server: $!\n&quot;;

print &quot;</body>&quot;;
print &quot;</html>&quot;;

as result I got: &quot;Failed to connect() to server: Permission denied&quot;, it seems to me that some firewall restrict my responses. How could I found this firewall and connect throught it? (LWP library doesn't exists on this server)
 
I'd be talking to my network administrator -- but first I'd be testing my script within your environment, just to make sure it's all hunky-dory before I bothered the admins.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top