finding_20the_20host_20ip_20address
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
finding_20the_20host_20ip_20address [2018/03/31 13:19] – external edit 127.0.0.1 | finding_20the_20host_20ip_20address [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
//by Richard Russell, May 2007//\\ \\ It is easy to discover the host PC's network name using the **FN_gethostname** function in the [[http:// | //by Richard Russell, May 2007//\\ \\ It is easy to discover the host PC's network name using the **FN_gethostname** function in the [[http:// | ||
+ | <code bb4w> | ||
INSTALL @lib$+" | INSTALL @lib$+" | ||
PROC_initsockets | PROC_initsockets | ||
Line 7: | Line 8: | ||
hostent% = FN_sethost(FN_gethostname) | hostent% = FN_sethost(FN_gethostname) | ||
hostip% = !!hostent%!12 | hostip% = !!hostent%!12 | ||
+ | </ | ||
The code sets **hostip%** to the host IP address; note the use of three exclamation marks! The **INSTALL** and **PROC_initsockets** statements are included here for completeness, | The code sets **hostip%** to the host IP address; note the use of three exclamation marks! The **INSTALL** and **PROC_initsockets** statements are included here for completeness, | ||
+ | <code bb4w> | ||
SYS `inet_ntoa`, | SYS `inet_ntoa`, | ||
hostip$ = $$lpszip% | hostip$ = $$lpszip% | ||
+ | </ | ||
This will set **hostip$** to a string in the conventional ' | This will set **hostip$** to a string in the conventional ' |
finding_20the_20host_20ip_20address.1522502360.txt.gz · Last modified: 2024/01/05 00:17 (external edit)