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
...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)
On 19 Jun 2020, Tiny said the following...
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.
Let me know if that gets you any further! :)
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.
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.
Sysop: | sneaky |
---|---|
Location: | Ashburton,NZ |
Users: | 31 |
Nodes: | 8 (0 / 8) |
Uptime: | 55:43:07 |
Calls: | 2,097 |
Calls today: | 1 |
Files: | 11,143 |
Messages: | 950,193 |