cmonlinecn has asked for the wisdom of the Perl Monks concerning the following question:

I use IIS as a web server,and wrote following script.If use perl.exe to execute the script ,it works ok,and connect success.But if I visit this page throw IE,the connection is fail.The error is "Can't create TCP/IP socket (10106)"; Can anybody give me some suggestion about this?
use DBI; my ($Driver, $DSN); $DSN = "DBI:mysql:database=forums;host=10.xx.xx.xx;port=3306"; $dbh = DBI->connect($DSN, "xxxxx", "xxxx"); print "ContentŁ­type:text/html\n\n"; print "< html>"; print "< head>"; print "< title>this is a test< /title>"; print "< /head>"; if($dbh) { print "< body>< p>OK success !< /body>"; } else { print "< body>< p>fail<p> $DBI::errstr< /body>"; } print "< /html>"; exit;

Edit by castaway added code tags

Replies are listed 'Best First'.
Re: DBI connection fail!
by izut (Chaplain) on Sep 27, 2005 at 11:17 UTC

    Linux allocates some port above 1024 to use for tcp socket connections. It seems your Windows box can't allocate the referred port - can it be a policy problem?


    Igor S. Lopes - izut
    surrender to perl. your code, your rules.
      As izut stated, this might be a policy problem. i thought IIS runs as it's own system user, you should be able to set the rights of that user.

      And did you also check your windows firewall?

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
        On top of Windows Internal Firewall, you can also check any software firewall you have installed on the machine, ie. ZoneAlarm or Norton Internet Security. They may be blocking this request also.

        Checking the Windows Event Logs may also lead some insite to what is happening.