Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news.kodak.com!news-nysernet-16.sprintlink.net!news-east1.sprintlink.net!news-peer1.sprintlink.net!news.sprintlink.net!howland.erols.net!dispose.news.demon.net!demon!newsfeed.icl.net!colt.net!news.belnet.be!news.tvd.be!feeder.nmix.net!198.59.136.4.MISMATCH!feeder.swcp.com!198.59.115.31.MISMATCH!news.cyberport.com!not-for-mail
From: Warren Young <[email protected]>
Newsgroups: alt.winsock.programming,comp.os.ms-windows.programmer.tools.winsock,alt.answers,comp.answers,news.answers
Subject: Winsock Programmer's FAQ (updated 1999.06.27)
Followup-To: poster
Date: 19 Jul 1999 16:28:53 GMT
Organization: CyberPort Station
Approved: [email protected]
Expires: Wed, 1 Sep 1999 00:00:00 GMT
Message-ID: <[email protected]>
NNTP-Posting-Host: 56k15-118.cyberport.com
X-Trace: macaw.cyberport.com 932401733 13246 204.134.118.15 (19 Jul 1999 16:28:53 GMT)
X-Complaints-To: [email protected]
NNTP-Posting-Date: 19 Jul 1999 16:28:53 GMT
Summary: Announcement for the major Winsock programming newsgroups' FAQ.
Lines: 220
Xref: senator-bedfellow.mit.edu alt.winsock.programming:12573 comp.os.ms-windows.programmer.tools.winsock:11541 alt.answers:43233 comp.answers:36977 news.answers:162668

Archive-name: windows/winsock/programmer-faq
Posting-Frequency: monthly (on or after the 19th)
Last-modified: 1999/6/27
URL: http://www.cyberport.com/~tangent/programming/winsock/
Copyright: (c) 1997-1999 Warren Young
Maintainer: Warren Young <[email protected]>
X-Disclaimer: Approval for *.answers is based on form, not content.

What Is The Winsock Programmer's FAQ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   The Winsock Programmer's FAQ is a resurrected and expanded version
   of the original Winsock FAQ by Mark Towfiq.  It is essentially
   a new work, though certain elements of its predecessor are still
   recognizable in the current FAQ.

Where Is The FAQ?
~~~~~~~~~~~~~~~~~
   The online version of the FAQ is located at:

       http://www.cyberport.com/~tangent/programming/winsock/

   If you must read it offline, an archived version is kept at:

       http://www.cyberport.com/~tangent/programming/winsock/wskfaq.zip

   This latter is a zipped version of the complete FAQ, including
   the graphics.  This archive is not kept strictly up to date.
   I do try and rebuild it for every major update to the page, but I
   make no guarantees.

What's New?
~~~~~~~~~~~
   The past month's activity on the FAQ follows:

       1999.07.19 - Updated the new "raw socket capabilities"
           table in item 3.1 with new information on what Windows
           2000 will support.

       1999.06.27 - Improved item 2.15, regarding the best way to
           send a broadcast packet.

           Changed item 3.17. It used to say that only buggy Winsock
           stacks and LSPs limited the number of sockets per select()
           to 64, but I've been reliably informed that at least one
           respected Winsock vendor's stack behaves this way, and they
           aren't willing to change it. So, the FAQ item now recommends
           against trying to force your way past this limitation.

           Improved item 3.18, to note that its advice won't help work
           around a certain Windows 9x bug, though it seems like it
           should help.

           I just found out a way to get quasi-dup2() functionality
           under Winsock. Thus, the BSD Compatibility and Question 3.3
           items have been updated.

           Added item 3.21, to point people wanting to know about the
           control bits in a TCP packet to the Debugging TCP tutorial
           which covers this.

           Added item 2.17, regarding advice for choosing server ports.

   This summary excludes typo fixes and updates to the Resources section.

What Does The FAQ Want To Be When It Grows Up?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   The FAQ's original focus was to attempt to answer all of the
   common questions, like "how do I do a ping", and "where can I get
   sample code".  However, the FAQ is growing into a general Winsock
   programmer's resource for all levels of Winsock programmers, not
   just beginners.

   The FAQ has a largish Resources section with links to code, company
   web sites, freeware and shareware for Winsock programming, etc.

   The FAQ is also now branching out with longer articles.  Currently,
   several tutorials exist, and more are on the way.  The Reviews
   section is also under way, but I can think of many additions it needs,
   mainly software.  (Software companies are welcome to email me with
   proposals for reviewing relevant packages!)  Outside contributions
   of tutorials and reviews are welcome.  See the following page under
   Future Directions for more info:

       http://www.cyberport.com/~tangent/programming/winsock/intro.html

   If you have an idea for a new FAQ item, I definitely want to hear from
   you.  I also welcome corrections and expansions to existing items.

The FAQ's Table of Contents
~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Section 0 - Introduction
       0.1 - The Original Introduction
       0.2 - A Bit About the Maintainer
       0.3 - Legal Stuff
       0.4 - Mirrors
       0.5 - What if your question is not in the FAQ?
       0.6 - Language Bias
       0.7 - Acknowledgements

   Section 1 - General Winsock Information
       1.1 - What is Winsock?
       1.2 - What is the latest version?
       1.3 - When is the next rev of the specification?
       1.4 - Where can I get a Winsock implementation?
       1.5 - Why isn't there just one Winsock DLL? Do I need a
             network stack to use it?
       1.6 - Is there a version of Winsock for { OS/2, DOS, UNIX,
             etc. }?
       1.7 - Can Winsock speak { DECNet, IPX/SPX, etc. }?
       1.8 - What does Winsock 2 have that Winsock 1.1 doesn't?
       1.9 - Where can I get Winsock 2?

   Section 2 - Issues for New Winsock Programmers
       2.1 - Are there any sample apps on the Net?
       2.2 - How do I speak { HTTP, POP3, SMTP, FTP, Telnet, NNTP,
             etc. } with Winsock?
       2.3 - How do I get my IP address from within a Winsock
             program?
       2.4 - What kind of socket should I use?
       2.5 - Do I need to initialize the WSAData structure before
             calling WSAStartup?
       2.6 - If I write a Winsock program, will I be able to
             communicate with a UNIX Sockets program?
       2.7 - Can I use Winsock with { Delphi, Visual Basic, Visual
             COBOL, etc. }?
       2.8 - How do I detect when my TCP connection is closed?
       2.9 - Are there any tools available for debugging Winsock
             programs?
       2.10 - How do I get a readable error message from a Winsock
             error number?
       2.11 - Winsock keeps returning the error WSAEWOULDBLOCK.
             What's wrong with my program?
       2.12 - What's the proper way to close a socket?
       2.13 - What can you tell me about MFC's CSocket and
             CAsyncSocket?
       2.14 - How can I change the timeout for a Winsock function?
       2.15 - How do I send a broadcast packet?
       2.16 - How do I detect an abnormal network disconnect?

   Section 3 - Advanced Winsock Issues
       3.1 - How can I open a raw data socket?
       3.2 - How can I "ping" another machine with Winsock?
       3.3 - How do I share a socket between two processes?
       3.4 - How can I get access to the {route, ARP, interface, etc.}
             table?
       3.5 - How can I get the local username?
       3.6 - Is it possible to create sockets that map to a DLL
             rather than an application?
       3.7 - I'm having trouble porting a BSD sockets program to
             Winsock. Help!
       3.8 - How do I get the MAC (a.k.a. hardware) address of the
             local Ethernet adapter?
       3.9 - In a multithreaded application, can more than one thread
             access a single socket?
       3.10 - If two threads in an application call recv() on a
             socket, will they each get the same data?
       3.11 - Is there any way for two threads to be notified when
             something happens on a socket?
       3.12 - How do I detect if the modem is connected?
       3.13 - How can I capture packets on a LAN with Winsock?
       3.14 - How can I change the IP or TCP header of a packet?
       3.15 - When should I turn off the Nagle algorithm?
       3.16 - How many simultaneous sockets can I have open with
             Winsock?
       3.17 - Can I change FD_SETSIZE to make select() wait on more
             than 64 sockets?
       3.18 - How do I make Winsock use a specific network interface
             to make a connection?
       3.19 - How do I write my program to work through a firewall?
       3.20 - Is it a bad idea to bind() to a particular port in a
             client program?

   Section 4 - Resources
       4.1 - Winsock Libraries and Controls
       4.2 - Sample Winsock Applications and Tutorials
       4.3 - Web Pages
       4.4 - Winsock SDKs and Specifications
       4.5 - Winsock Debugging Tools
       4.6 - Network Suite Vendors
       4.7 - Miscellaneous

   Section 5 - Examples
       Example 1 - Getting the Local IP Address
       Example 2 - Pinging a Host Using Microsoft's ICMP.DLL
       Example 3 - Pinging a Host Using Raw Sockets
       Example 4 - How to Get the Local User Name
       Example 5 - How to Pass a Socket Handle in Win32
       Example 6 - How to Get the MAC (a.k.a. "hardware") Address,
             NetBIOS method
       Example 7 - How to Get the MAC (a.k.a. "hardware") Address,
             RPC method
       Example 8 - Getting the Network Interface List
       Example 9 - Finding the Maximum Number of Open Sockets
       Example 10 - Several Basic Winsock Programs

   Section 6 - Tutorials
       Tutorial 1 - What Kind of Socket Should I Use?
       Tutorial 2 - Winsock for the Impatient
       Tutorial 3 - Winsock's Compatibility With BSD Sockets
       Tutorial 4 - Why Does Winsock Keep Corrupting My Data?
       Tutorial 5 - Debugging TCP
       Tutorial 6 - The Lame List

   Section 7 - Reviews
       Books
           Win32 Network Programming by Ralph Davis
           WinSock 2.0 by Lewis Napper
           Windows Sockets Network Programming by Bob Quinn and Dave Shute
           TCP/IP Illustrated, volume 1 by W. Richard Stevens
           UNIX Network Programming, volume 1 by W. Richard Stevens

       Software
           Nothing yet!

  Section 8 - Glossary

--
Warren Young -- Maintainer of The Winsock Programmer's FAQ
Please, do not send unsolicited commercial email.