fsockopen cannot connect to some mail server ports


  1. Posts : 4
    Windows 7 Ultimate 32-bit
       #1

    fsockopen cannot connect to some mail server ports


    I have a web server and a mail server running under Win 7 on my LAN, most smoothly,
    but I want to be alerted when the servers appear down to the WAN.
    So I wrote a PHP script and sent it to a remote web server,
    and invoke the script from my web browser on the LAN.

    The script checks my domain's MX records for hosts,
    then converts the mail server's host name to IP,
    then connects to IP's IMAPS, POP3S and SMTPS ports (933, 995, 465)
    and receives the welcome messages.
    It then connects to my web server on HTTPS and HTTP ports (443 and 80),
    and sends a simple HEAD request and receives the response.

    At each stage the answers are checked against what is expected
    and the results are reported on the web page.

    That the script works for :465 attests to the correctness of the PHP script.
    The only problem is that the connections to :993 and :995 always fail:
    "110 Connection timed out"
    while the others always work OK.
    Meanwhile I have email clients connecting successfully on :993 and :995 all the time.

    ========================================
    14:00:36 xxxxx.org.au MX records mail.xxxxx.org.au
    14:00:37 mail.xxxxx.org.au IP ad 122.148.xx.xx
    14:00:37 ssl://122.148.xx.xx:993 110 Connection timed out
    14:00:42 ssl://122.148.xx.xx:995 110 Connection timed out
    14:00:47 ssl://122.148.xx.xx:465 220 122-148-xx-xx.static.dsl.dodo.com.au
    14:00:48 ssl://122.148.xx.xx:443 200 OK
    14:00:50 tcp://122.148.xx.xx:80 200 OK
    14:00:51 Waiting 5 minutes ...
    =========================================

    So I asked the remote server's support staff if they were blocking this kind of traffic.
    I don't see why they should, but I am at a loss for any other explanation.
    They don't seem to understand the question, and can't give me a straight answer.

    So my question to you is:
    Have I successfully demonstrated that they ARE blocking this kind of traffic, or could there be some other explanation ?
    (Bear in mind that there are clients accessing the servers without a problem all the time, apart from when the internet network partially fails)

    The key PHP (5.2.17) statement is:
    $server = fsockopen( ($transport.$ip.':'.$port), $errno, $errstring, $timeout);
    but it does the same thing with stream_socket_client() .
      My Computer


  2. Posts : 4
    Windows 7 Ultimate 32-bit
    Thread Starter
       #2

    minor correction


    In the last paragraph the code should read:
    $server = fsockopen( ($transport.$ip), $port, $errno, $errstring, $timeout);
    or
    $server = stream_socket_client( ($transport.$ip.':'.$port), $errno, $errstring, $timeout);
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:34.
Find Us