• Batch file help?

    From Tiny@21:1/130 to All on Friday, June 19, 2020 08:00:58
    Hey guys,

    I've been fighting with a batch file for about a week now. <Sigh> It
    works if I put the IP address in, but not using the name.

    All I want is OK or Error. I alwyas get Error with the
    tinysbbs.hopto.org, and I do get OK with the IP, problem is I don't
    have a static IP. Any ideas?

    ---------
    @echo off
    setlocal
    REM set "servers=72.141.109.101:2023"
    set "servers=tinysbbs.hopto.org:2023"
    for %%I in (%servers%) do (
    for /f "tokens=1,2 delims=:" %%a in ("%%I") do (
    set "port=%%~b"
    if not defined port set "port=8080"
    setlocal enabledelayedexpansion
    call :handshake "%%~a" "!port!" && (
    echo %%a port !port!: OK
    ) || (
    echo %%a port !port!: Error
    )
    endlocal
    )
    )
    goto :EOF
    :handshake <server> <port>
    powershell "$t=new-objectNet.Sockets.TcpClient;$c=$t.BeginConnect('%~1',%~2,{},{});if($c.AsyncWaitHandle.WaitOne(1000)){$t.EndConnect($c);exit 0};exit 1"
    exit /b %ERRORLEVEL%

    ------
    Shawn

    ... Never test for an error you don't know how to handle.

    --- EzyBlueWave V3.00 01FB001F
    * Origin: Tiny's BBS - telnet://tinysbbs.com:3023 (21:1/130)
  • From dejavu@21:3/114 to Tiny on Friday, June 19, 2020 13:06:24
    On 19 Jun 2020, Tiny said the following...

    Hey guys,

    I've been fighting with a batch file for about a week now. <Sigh> It
    works if I put the IP address in, but not using the name.

    All I want is OK or Error. I alwyas get Error with the
    tinysbbs.hopto.org, and I do get OK with the IP, problem is I don't
    have a static IP. Any ideas?

    ---------
    @echo off
    setlocal
    REM set "servers=72.141.109.101:2023"
    set "servers=tinysbbs.hopto.org:2023"
    for %%I in (%servers%) do (
    for /f "tokens=1,2 delims=:" %%a in ("%%I") do (
    set "port=%%~b"
    if not defined port set "port=8080"
    setlocal enabledelayedexpansion
    call :handshake "%%~a" "!port!" && (
    echo %%a port !port!: OK
    ) || (
    echo %%a port !port!: Error
    )
    endlocal
    )
    )
    goto :EOF
    :handshake <server> <port>
    powershell "$t=new-objectNet.Sockets.TcpClient;$c=$t.BeginConnect('%~1',%~2,{},{});if syncWaitHandle.WaitOne(1000)){$t.EndConnect($c);exit 0};exit 1"
    exit /b %ERRORLEVEL%

    ------
    Shawn


    Tiny,
    I would recommend adding some debug logging to output errors along the way.

    As for a test, test making your host-name no longer than 3 chars and run
    again, just as a test. I'm blowing spit bubbles here, that might get you
    over the hump enough to find the actual problem :)

    Try changing your host-name to fit www.xxx.yyy.zzz:####, ie., the spacing of
    IP addresses. So temporarily test your host-name as: "tin.ysb.bsh.org:2023" just as a test and see what the outcome is. If it works, you know that the char limit is the issue.

    ...
    Never test for an error you don't know how to handle. Ti>
    --- EzyBlueWave V3.00 01FB001F
    * Origin: Tiny's BBS - telnet://tinysbbs.com:3023 (21:1/130)

    Let me know if that gets you any further! :)

    -Dejavu

    --- Mystic BBS v1.12 A45 2020/02/18 (Linux/32)
    * Origin: 1984 BBS [1984bbs.net:23] Washington, DC (21:3/114)
  • From Tiny@21:1/130.6 to dejavu on Friday, June 19, 2020 16:44:44
    On 19 Jun 2020, Tiny said the following...

    de> As for a test, test making your host-name no longer than 3 chars
    and run again, just as a test. I'm blowing spit bubbles here,
    that might get you over the hump enough to find the actual problem
    :)

    Can you remind me how to do that again please?

    Try changing your host-name to fit www.xxx.yyy.zzz:####, ie., the
    spacing of IP addresses. So temporarily test your host-name as: "tin.ysb.bsh.org:2023" just as a test and see what the outcome is.
    If it works, you know that the char limit is the issue.

    No that didn't work. :)

    Let me know if that gets you any further! :)

    Not giving up yet. ;)

    Shawn

    --- MagickaBBS v0.15alpha (Linux/x86_64)
    * Origin: Tiny's BBS - telnet://tinysbbs.hopto.org:2023 (21:1/130.6)
  • From Spectre@21:3/101 to Tiny on Saturday, June 20, 2020 08:57:00
    Try changing your host-name to fit www.xxx.yyy.zzz:####, ie., the spacing of IP addresses. So temporarily test your host-name as: "tin.ysb.bsh.org:2023" just as a test and see what the outcome is.
    If it works, you know that the char limit is the issue.

    You've always got the possibility its only looking for dotted quad, no an fqdn.. in which case it might be better to resolve the name earlier and keep the ip address.

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From Tiny@21:1/130 to Spectre on Saturday, June 20, 2020 10:31:28
    Quoting Spectre to Tiny <=-

    You've always got the possibility its only looking for dotted quad, no
    an fqdn.. in which case it might be better to resolve the name earlier
    and keep the ip address.

    Turns out it was the timeout value in the powershell line. I
    increased it to 4000 from 1000 and voila now enough time for DNS to
    answer. Thanks though.

    Shawn

    ... Next time you wave, use ALL of your fingers!!

    --- EzyBlueWave V3.00 01FB001F
    * Origin: Tiny's BBS - telnet://tinysbbs.com:3023 (21:1/130)