jvanegmond Posted October 20, 2010 Share Posted October 20, 2010 Didn't find anything like this on the forum so I thought it would be worth sharing. Surely someone out there has a use for this since it's one of the more common reasons why I start up uTorrent for their port forwarding check tool. The method I use from yougetsignal.com isn't officially supported, I think. Might be good to write a service for that yourself and put it online. Let me know if you do and you want other people to use it for free. $port = InputBox("Port forwarding check", "Enter a port number to see if it can be reached from the web") If @error Then Exit $port = Number($port) ConsoleWrite("Checking port " & $port & @CRLF) $url = "http://www.yougetsignal.com/tools/open-ports/php/check-port.php?portNumber=" & $port TCPStartup() $MainSocket = TCPListen(@IPAddress1, $port) If @error Then MsgBox(0, "Port forwarding check", "Can't check if port " & $port & " is open because it is in use or out of range.") Exit EndIf Sleep(250) $handle = InetGet($url, "temp.html", 1, 0) While 1 $ConnectedSocket = TCPAccept($MainSocket) If $ConnectedSocket >= 0 Then MsgBox(0,"Port forwarding check", "Port " & $port & " is open!") ConsoleWrite("Port " & $port & " is open!" & @CRLF) Exit EndIf If FileExists("temp.html") Then ; Couldn't get this working with InetGetInfo and couldn't bother looking around why (maybe old AutoIt?) MsgBox(0, "Port forwarding check", "Port " & $port & " is closed. :(") ConsoleWrite("Port " & $port & " is closed. :(" & @CRLF) Exit EndIf Wend github.com/jvanegmond Link to comment Share on other sites More sharing options...
jaberwacky Posted October 21, 2010 Share Posted October 21, 2010 (edited) It's quite possible that I overlooked something but when I forwarded a port then uTorrent says that port is open but this script says that that the port is closed. Have I misunderstood something?No, nvm, my bad. Works fine. Edited October 21, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now