Using Win32 functions in Visual FoxPro Image Gallery
Windows Sockets 2 (Winsock)
..msdn
accept
bind
closesocket
gethostbyaddr
gethostbyname
gethostname
getnameinfo
getprotobyname
getprotobynumber
getservbyname
getservbyport
getsockopt
htonl
htons
inet_addr
inet_ntoa
listen
ntohl
ntohs
recv
recvfrom
send
sendto
setsockopt
socket
WSACleanup
WSACloseEvent
WSAConnect
WSACreateEvent
WSAEnumProtocols
WSAEventSelect
WSAGetLastError
WSARecv
WSASend
WSAStartup
WSAWaitForMultipleEvents
ws_connect
ws_select
Code examples:
Winsock: changing the byte ordering
Winsock: changing the byte ordering

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
 
* you do not need to call the WSAStartup function
* before using these functions
 
DECLARE INTEGER ntohs IN ws2_32 INTEGER netshort
DECLARE INTEGER ntohl IN ws2_32 INTEGER netlong
DECLARE INTEGER htonl IN ws2_32 INTEGER hostlong
DECLARE INTEGER 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)
?    
 
DECLARE INTEGER inet_addr IN ws2_32 STRING cp
DECLARE STRING 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)
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1319 bytes  
Created: 2001-12-19 19:02:10  
Modified: 2001-12-19 19:02:56  
Visits in 7 days: 86  
Listed functions:
htonl
htons
inet_addr
inet_ntoa
ntohl
ntohs
WSAStartup
Printer friendly API declarations
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
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.
Last Topics Visited (23.22.252.150)
4.42 hrs.Example: 'Displaying the associated icons and descriptions for files and folders'
 Function: 'PathCombine'
Function group: 'Shell Lightweight Utility APIs -- Path Functions'
4.43 hrs.Function: 'WritePrivateProfileSection'
Function group: 'Registry'
14.15 hrs.Example: 'Saying "Hello World!" with VFP and WinAPI'
14.16 hrs.Example: 'How to create a desktop shortcut (shell link)'
 Function: 'GetRegionData'
15.65 hrs.Example: 'Retrieving the System Time adjustment'
15.66 hrs.Function: 'NetShareDel'
16.28 hrs.Example: 'Initiating Inet connection using a modem'
 Function: 'waveInReset'
Google
Advertise here!