I have been pulling my hair out for a couple of days trying to find out why my perl program on a remote server wasn't able to connect to my webserver's ip with a non-stadard port specified, such as:

code snippet: $response = $ua->post("https://123.321.123.321:4430/scripts/my_script. +cgi", [%parameters]);

The $response->content from this unsuccessful attempt was: 500 Can't connect to 123.321.123.321:4430 (connect: timeout)

So, I tried changing the port forwarding so the standard ports 443/80 are forwarded to my webserver and WAS SUCCESSFUL with no port specified:

code snippet: $response = $ua->post("https://123.321.123.321/scripts/my_script.cgi", + [%parameters]);

Now the interesting thing is that running the requesting program from my test machine (Windows) I was able to connect BOTH ways successfully, but from my "live" machine (ISP - Linux) I can only connect to the standard port 80 with no port specified in the url. So, can anyone tell me why this is the case? I did some searching online and found references to a bug in Linux and/or IO::Socket on Linux that may cause this problem, but it wasn't clear to me. Any further enlightenment would be great. I would really prefer to run the webserver to which I am connecting for this task behind ports 4430/8080, not ports 443/80.


In reply to LWP connect timeout only occurs with a port specified by twotone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.