BCX Console Demonstration Program S92.bas

 '-------------------------------------------------------
 '           Display Winsock Version Information
 '-------------------------------------------------------
 $HEADER
 #if defined (__LCC__)
  #include <winsock2.h>
 #endif
 $HEADER
 
 $LIBRARY <WSOCK32.LIB>          ' LINK WITH WSOCK32.LIB
 
 GLOBAL  wVersionRequested
 GLOBAL  wsaData AS WSADATA
 GLOBAL  rc
 
 wVersionRequested = MAKEWORD(1,1)
 
 rc = WSAStartup(wVersionRequested, &wsaData)
 
 IF NOT rc THEN
   PrintWSAData(&wsaData)
 ELSE
   PRINT "Winsock error"
 END IF
 
 WSACleanup()
 
 SUB PrintWSAData(pWSAData AS LPWSADATA)
 
   DIM  Lo
   DIM  Hi
   DIM  I
   DIM  A$
 
   '-------------------------------------
   PRINT "Winsock Version Information"
   '-------------------------------------
   Lo = LOBYTE(pWSAData->wVersion)
   Hi = HIBYTE(pWSAData->wVersion)
   A$ = LTRIM$(STR$(Lo)) & "." & LTRIM$(STR$(Hi))
   PRINT "Version: ", A$
   '-------------------------------------
   Lo = LOBYTE(pWSAData->wHighVersion)
   Hi = HIBYTE(pWSAData->wHighVersion)
   A$ = LTRIM$(STR$(Lo)) & "." &  LTRIM$(STR$(Hi))
   PRINT "HighVersion: ", A$
   '-------------------------------------
   A$ = pWSAData->szDescription$
   PRINT "Description: ", A$
   '-------------------------------------
   A$ = pWSAData->szSystemStatus$
   PRINT "System status: ", A$
   '-------------------------------------
   I = pWSAData->iMaxSockets
   PRINT "Max number of sockets: ", I
   '-------------------------------------
   I = pWSAData->iMaxUdpDg
   PRINT "MAX UDP datagram size: ", I
   '-------------------------------------
 END SUB