* you do not need to call the WSAStartup function* before using these functionsDECLAREINTEGER ntohs IN ws2_32 INTEGER netshort
DECLAREINTEGER ntohl IN ws2_32 INTEGER netlong
DECLAREINTEGER htonl IN ws2_32 INTEGER hostlong
DECLAREINTEGER htons IN ws2_32 INTEGER hostshort
* HOST to NET u_short -- htons* NET to HOST u_short -- ntohs* HOST to NET u_long -- htonl* NET to HOST u_long -- ntohl
? "*** Working with U_SHORT values"
lnFtpPort = htons(21)?"Converted to the network byte order:",lnFtpPort
?"Host byte order again:", ntohs(lnFtpPort)??"*** Working with U_LONG values"
lnTelnetPort = htonl(23)?"Converted to the network byte order:", lnTelnetPort
?"Host byte order again:", ntohl(lnTelnetPort)?DECLAREINTEGER inet_addr IN ws2_32 STRING cp
DECLARESTRING inet_ntoa IN ws2_32 INTEGER in_addr
* The inet_addr function converts a string containing an (Ipv4) * Internet Protocol dotted address into a proper address * for the IN_ADDR structure
? "*** Converting IP addresses"
lnIP = inet_addr("127.0.0.1")
? "String value converted into a proper address:", lnIP
* The inet_ntoa function converts an (Ipv4) Internet network address * into a string in Internet standard dotted format
? "Converted back to a string value:", inet_ntoa (lnIP)
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
AceHTML Freeware
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.