know the port status of a IP

343 views
Skip to first unread message

escafoi...@gmail.com

unread,
Feb 22, 2014, 8:13:10 AM2/22/14
to mitappinv...@googlegroups.com
Hello, im trying make a program that send request, sent a get, or something that get know that a port in a ip is up or down.
some idea? using console, ping, http, tracert.
i was trying with http get and i dont get it.
ty.

Aaron Prindle

unread,
Feb 23, 2014, 2:45:42 AM2/23/14
to mitappinv...@googlegroups.com, escafoi...@gmail.com

You will need to use the Web component , set its url via Web.url to the specified website and port (ex: www.websiteyouwant.com:port#), then call Web.get to make the http request to the website.  Then you can choose what to do with the data with the Web.GotText callback.  If the response code is 200, everything went well.  Here is a list of what responseCodes mean http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html  Using the responseCode recieved from the Web.GotText you should be able to tell if the ip is up or down.  I have attached a picture of an example:

escafoi...@gmail.com

unread,
Feb 23, 2014, 6:07:29 AM2/23/14
to mitappinv...@googlegroups.com, escafoi...@gmail.com
that is fine with a webpage or ip that send you a tex, but ill like check a game server, that not response with text.
Ill like check for example this ip port http://64.25.35.103:2106.
i thinked that as in emulator appeart a -1 all resolved but no.
if you get some idea that how can be resolved.... you can check with that ip and port i send you. ty alot!!!

Aaron Prindle

unread,
Mar 3, 2014, 3:33:28 AM3/3/14
to mitappinv...@googlegroups.com, escafoi...@gmail.com
I could not, with current AppInventor components, get this to work.  I tried but it seems that the Web component will not accept data formatted like that at the ip you gave.

escafoi...@gmail.com

unread,
Mar 5, 2014, 1:04:18 PM3/5/14
to mitappinv...@googlegroups.com, escafoi...@gmail.com
ok im investigate more if i find some solution i public here

escafoi...@gmail.com

unread,
Mar 12, 2014, 2:48:15 PM3/12/14
to mitappinv...@googlegroups.com, escafoi...@gmail.com
i found the solution, when a ip or a web page not give you a text at response, and you want know if the ip is up or down, you must use un web1.get and the url must be in this format http://xxx.xxx.xxx.xxx:xxxx (ip:port) and use screen1.errorocurred because you will get an error for sure. for know the diferent between server up or donw you must use a timer. If the server is up you will get the error in less of 1 or 2 second. if the server is down you will get the same error but the time is bigger about 10 or more seconds.
for you be sure that all this run. first you must check the conecction for example you can do a get before to google and check if the response is fast you have good conection. this is a bad way to check good conection and always must be wifi. in other post ill ask about how to check wifi conection.

I wait all understand.
ty all
Reply all
Reply to author
Forward
0 new messages