Click to open or copy the files for the WSock sample.
This sample demonstrates the basics of sockets programming, specifically for Windows Sockets. It demonstrates how to accept incoming connections (using the Windows Sockets Asynchronous Extension APIs, threads, and traditional BSD-style blocking calls) and how to connect to remote hosts. Once connected, you can send a text string to the remote host. Wsock also allows the user to view information on a user-entered host name.
Wsock demonstrates how to use AcceptEx, which is a Microsoft specific extension to Windows Sockets and which is only supported on Windows NTŪ.
This sample uses the following keywords:
_beginthread; _endthread; accept; acceptex; acceptthreadproc; atoi; bind; closesocket; connect; createevent; createwindow; defwindowproc; dialogbox; dispatchmessage; displayhostent; enablemenuitem; enddialog; filladdr; getdlgitem; getdlgitemtext; gethostbyname; gethostname; getmenu; getmessage; getsendstring; getservbyname; getstockobject; gettcpport; htons; initapplication; initinstance; listen; loadcursor; mainwndproc; makeword; memcpy; messagebox; postquitmessage; recv; registerclass; send; senddlgitemmessage; setconnectmenus; setfocus; setsockopt; setwindowtext; showwindow; socket; sprintf; switch; translatemessage; unreferenced_parameter; updatewindow; winmain; wsaasyncselect; wsacleanup; wsagetlasterror; wsagetselecterror; wsagetselectevent; wsastartup; wsprintf