Check \SampleScripts\INet\INet_GetIPs.tBasic
Hi,
I'm looking to use host_addr and I receive a run time error popup
saying "HOST_ADDR" variable not defined or mispelled keyword
I guess I have toBut the help pages does not indicate the name of the needed moduleuses "the good module"
I tried
without success.uses "inet" uses "lan"
Please . . . . .
Regards,
Dany
Last edited by dco045; 28-01-2018 at 22:55.
Check \SampleScripts\INet\INet_GetIPs.tBasic
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Module is iNet
Your computer can have multiple network cards and cards can be activate/deactivated on the fly. For example if you connect to WiFi networks or you activate a VPN over a network.
Uses "inet"Uses "Console" Long lCount While %true PrintL "Number of interfaces present:", INET_GetInterfaces PrintL "------------------------------------------" PrintL "-##-[IP ] [SubNet ] [Type]" PrintL "------------------------------------------" For lCount = 1 To INET_GetInterfaces PrintL Format$(lCount, " 00"), _ Using$("\ \", INET_GetIp(lCount)), _ Using$("\ \", INET_GetSubNet(lCount)), _ Format$(INet_GetIpType(lCount), "0000") Next PrintL "------------------------------------------" PrintL PrintL " Press [ESC] to finish" PrintL " 4 seconds for the next auto refresh " PrintL " any key to refresh " PrintL "------------------------------------------" If WaitKey(4) = "[ESC]" Then Exit While Cls Wend
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Hi Eros,
Your example works fine. But what about functions :
as they appear in online and offline Helpfiles ?n = HOST_ADDR [(nIndex)] s = HOSTIP_TONAME(nIP) n = HOSTNAME_TOIP(sHost)
Regards,
Dany
If you press F1 while above a keyword you should get help about that keyword.
Help should say which module that keyword is inside.
The mentioned functions are inside TcpUdp module.
TcpUdp module implements some functionalities to create a Tcp or Udt server or use Tcp or Udp protocol to connect to a server that exposes some functionality over network.
There are some scripts inside \SampleScripts\TcpUdp\ directory that can show how to create a network communication using Tcp and Udp
Example on your mentioned functions:
uses "TcpUdp"uses "Console" string sHost = "www.google.com" Long nIp nIp = HOSTNAME_TOIP(sHost) '---How your DNS resolve a host name printl "HOSTNAME_TOIP of", sHost, "is", nIp printl "IP_ToString is", IP_ToString(nIp) '---Translate Ip address into human one printl "HOSTIP_TONAME is", HOSTIP_TONAME(nIp) '---How your DNS knows the ip WaitKey
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
HI Eros,
But the reason I posted on these function is that the relevant
doesn't appear in help files either online or offline.uses "tcpudp"
As I said in my PM of 21 january, I begin using ThinBasic and I make huge use of help files, and before disturbing TB developpers , be sure that, I try, try, press F1, read help, look in SamplesScripts. My F1 key is completely worn out.
So for this precise case, help files may be completed.
Regards,
Dany
Last edited by dco045; 31-01-2018 at 13:15.
Strange
What thinBasic version are you using?
You can check thinBasic verion inside thinAir/Help menu/About thinAIr/
Please check here for online but you should also see in offline, both are generated from the same source:
http://www.thinbasic.com/public/prod...tml?tcpudp.htm
http://www.thinbasic.com/public/prod...?host_addr.htm
http://www.thinbasic.com/public/prod...tname_toip.htm
Yes, help is not so much exhaustive ... I admit, but should be there.
Latest thinBasic version is 1.10.4.0: http://www.thinbasic.com/community/s...inBasic-1-10-x
It is Beta but quite stable
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Hi Eros.
Version 1.9.16.17 . I only downloaded 1.10 on a sandbox PC. I am prudent with versions labelled as Beta. But if you say 'quite stable ' ? I'll try it.
The problem comes because I was looking for Hex$() syntax, using either online(web) or offline help.
Using index view, I then saw host_addr, hostip_toname and hostname_toip functions, I remembered a tool I had on Unix. I wanted to try, but by this way, we do not know the necessary ' uses "module " '.
That's why I asked that question. Maybe it's worth remembering the "uses" in the pages of these functions.
As we say in France : "ça va sans dire, mais ça va mieux en le disant" , "It goes without saying, but it's better by saying it", "Inutile dire, ma è meglio dirlo"
Best regards,
Dany
As you well know writing documentation is one of the hardest part in a project.
Also writing documentation is something you learn, sometimes from others having more experience.
thinBasic Help material is my only experience in writing documentation and I missed suggestions from professionals.
So I'm here to absorb indications and do better.
The idea that I've followed is:
- I've structured all thinBasic modules in a tree under "thinBasic modules" http://www.thinbasic.com/public/prod...ic_modules.htm
In this page is described what are thinBasic modules and how to use them- Then every module has a module home page that indicates how to use that specific module: http://www.thinbasic.com/public/prod...tml?tcpudp.htm
- under module home page, all features inside that module are dependent to the fact that you need to load that module in your script using: USES "module name"
I have to admit it is not so clear and immediate to understand.
Now ... what to change in order to make module/keywords/features dependency without the need to change all thinBasic keywords?
Modules_In_Help.JPG
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Hi Eros, Dany,
my experience with documentation is that no matter how good it is, people prefer to not read it a all and jump to action first. That does not mean there is no point to do documentation, but that the guidance of the user can be approached differently for some cases.
So what about the following hint for the programmer - when thinBASIC finds unknown keyword ( error 30 ) or Variable not defined or misspelled Keyword ( error 18 ), thinBasic could take the token found and try to find it in all installed modules, hinting the user.
To give example:
This now reports "Variable not defined or misspelled Keyword" for token "DegToRad".uses "Console" print strformat$("45 degress to radians is {1}", DegToRad(45)) waitkey
With my suggestion, thinBASIC would lookup tokens defined in all installed modules and as a result give hint:
"Consider adding Uses "Math" to your script"
I think it would be perfectly okay to have the module token list done statically (file generated during thinBASIC installation creation).
Petr
Last edited by Petr Schreiber; 07-02-2018 at 22:41.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks