Sunday, February 23, 2014

Windows Network API

Berkeley Compatible Sockets function similar to UNIx.  It is implemented in the Winsock libraries, primarily in ws2_32.dll.  Common socket functions:

  • socket - create a socket
  • bind - attach a socket to a port
  • listen - start a socket to listen to a port
  • accept - open a connection to a remote socket and accept the connection
  • connect - open a connection to a remote socket which is waiting for a connection
  • recv - receive data
  • send - send data

Prior to use these function, the WSAStartup function must be call to load the network library and allocate resources.

WinINet is a higher level API which implement HTTP and FTP protocols.  It is implemented in Wininet.dll.
  • InternetOpen - initialize a connect to Internet
  • InternetOpen Url - open a connection to HTTP or FTP site
  • InternetReadFile - retrieve a file from the site

No comments: