Winsock Programmer's FAQ |
2000.06.18 Added definitions for TCP and UDP to the FAQ's glossary. 2000.06.16 Added a new item, "What if the firewall does not support SOCKS?" This deals with the politics of getting through a firewall where the admins have blocked all but a few ports, and your app is written to use one of the blocked ports. 2000.06.14 Updated the glossary with several new items, and improved many others. Moved the main text of some of the longer glossary items into the main FAQ. The new items are What is the Nagle algorithm?, What is TCP's sliding window?, What is the silly window syndrome?, and What is the delayed ACK algorithm?. Added an item for the true newbies, What's the difference between Winsock and TCP/IP?. I wouldn't have believed the need for the item if I hadn't seen the question on a newsgroup.... Added an item covering the newsgroups and mailing lists that cover Winsock and TCP/IP. Added info on Winsock for the Macintosh (Yes, there is such a beast!) 2000.06.12 Today I did a major update to the BSD sockets compatibility article. This
includes new info on #include file differences, discussion of BSD's
Expanded the FAQ item that talked about the
FD_SETSIZE limitation of 64 sockets. (This causes 2000.05.24 Doug Martin rightly pointed
out that RAS isn't available on all systems, so simply using the
2000.05.18 The numbers were literally off by an order of magnitude in my TCP window size item. So, I changed the example from 10BaseT to 100BaseT and recomputed. Now the question matches my predetermined answers. :) 2000.05.16 Rewrote the item about TCP window sizes. The new version is clearer and provides more information. I just found out that the MFC tradition of bad network class design continues in their new CCESocket class. I almost added an item to the main FAQ to discuss it, but then I realized I was starting to get very...shall we say...editorial. So, I converted the existing CSocket item to an article and added the CCESocket material to that. Reorganized several FAQ answers to be more positive: caveats or warnings are now at the end of items rather than up front. Before, some items sounded naggy, especially to those who already knew the caveats. Added an item that covers the "are asynch sockets reliable?" issue. 2000.05.12 Added an item discussing the TCP window size. Added a Resources section covering interesting MS Knowledge Base articles. 2000.05.01 Added multithreaded server and select()-based server example programs. Updated basic examples' Makefile so that it works with several command line compilers: Visual C++ 5.0 (and hopefully 6.0), the free version of Borland C++ 5.5, and Cygnus' port of GNU C++ 2.91 (Cygwin 1.0). 2000.04.25 Added info to the item about detecting abnormal disconnects warning against using keepalives to detect these sorts of problems. 2000.04.24 Fixed several "point-0" problems. (Yes, FAQs have them, too!) 2000.04.23 Finished the redesign. This also marks the first FAQ announcement in several months. Added the review of Jones and Ohlund's Network Programming for Microsoft Windows. Added an article by Tom Sanfilippo that
shows how to use the undocumented
(I didn't plan it, but this "FAQ rebirth" occurred on Easter Sunday. Apropriate, no?) 2000.03.26 Today I began a total revamp of the FAQ's look, content and organization. Virtually every FAQ item got minor changes, and several have been completely rewritten. The FAQ's organization is rather different now, too. Many of the items from the previous "newbie" and "advanced" sections have been culled to make a new "intermediate" section. Another problem I fixed is that the old FAQ organization required that I always add new items at the end of a section instead of near related items. For the same reason, the previous FAQ organization didn't allow me to delete or move items. For these reasons and others, if you had hyperlinks to particular items on these pages, they are definitely now broken! Most importantly for you, the reader, is that I've made quite an effort to make this FAQ more maintainable. Hopefully this will decrease the amount of procrastinating I do, so changes and additions will get done on a more timely schedule. NOTE: I removed all hyperlinks from this point forward since the redesign pretty much made them all bogus.1999.09.25 Added some more info to the BSD Sockets Compatibility tutorial. 1999.08.30 Updated the ICMP Ping Example so that it compiles cleaner, and updated the commentary to note that the program still works on Microsoft's newest platforms (Win98 and Win2K) despite their past threats to remove the API. Added some new info on the "how many sockets can you have open" problem discussed in Question 3.16. The new info discloses kernel internals that limit the number of sockets you can create on Windows NT 4.0 and Windows 2000. The item also includes some empirical data I've collected from Internet postings; some conclusions are drawn based on this data and the known kernel algorithms. I also added some info on increasing the low hard limit imposed under Win9x. Improved the accuracy of the info on waitable timers in Question 2.14. Added the Search function, courtesy of FreeFind. Added Question 2.18, regarding the Winsock link library. (This question comes up with distressing frequency, so I broke down and added it to the FAQ. What is the world coming to? :-/) 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 Fixed several broken links and added a number of new items to the Debugging page of the FAQ's Resources section. 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. 1999.04.12 Revamped Tutorial 4. I reworked the existing text, added some examples and went into more depth on some topics. More importantly, I changed the title from "Why Does Winsock Keep Corrupting My Data?" to "How to Use TCP Effectively". In the eight months that the tutorial has been online, I've come to realize that the original title was not quite accurate, so that many who should have read the tutorial were skipping over it because they didn't realize that it applied to problems they were having. Updated Question 2.14 with information on aborting a wait on an event object by using a waitable timer. Added Question 2.15, regarding broadcasting. Split Question 2.8: the new Q2.8 deals with normal TCP disconnects. The rest of the information from the old Q2.8, having to do with abnormal network disconnects, is now in Question 2.16. Reports indicate that my getifaces sample fails on Windows 95, so I've updated that page to reflect this. 1999.04.08 Tweaked some of the answers in Section 3 for accuracy. 1999.04.05 Item 3.14 basically said "you can't do that" to people wanting to do low-level network I/O. That's only true if you're just talking about the Winsock API. The current answer for that question breaks out of that box and provides pointers to other mechanisms for accessing the lower levels of the network stack. I normally don't announce updates to the pages in the Resources section, because most often the changes merely reflect a site that has moved or something similarly trivial. This latest change is fairly significant, though: the Web Pages page now has links to a number of related FAQs. 1999.03.25 Small changes to this main page and also to the Mirrors section. 1999.03.21 Added item 0.6, which explains the FAQ's programming language bias and the reasons for it. Note that I moved the old item 0.6 (Acknowledgements) to 0.7. I did this because I prefer to keep the Acknowledgements section in its traditional place, at the end of the introductory material. Simplified the answer to Question 0.5, which discusses the reasons I prefer not to answer Winsock questions by email. Updated Question 1.6, mainly with more information on alternatives to Winsock for DOS programmers. Also added a paragraph to clear up the confusion between a DOS program and a console mode program which happens to run in a "DOS box" on Win32. (Many people, when they say they want to write a Winsock program that runs under DOS, really just want a console mode program.) 1999.03.17 (Saint Patrick's Day!) Updated Question 2.7 again, this time to clarify the language issues some more. Revamped the answer to Question 3.9 again. I looked back over the previous update and was still unhappy with the way the item was phrased. So, I started working on it and ended up rewriting the whole item! As a result of the previous change, I touched up Question 3.10, because it referred to the old Q3.9 language. 1999.03.12 Updated Question 2.7 to better cover the issues associated with programming Winsock in languages other than C or C++. Clarified the answer to Question 3.9, regarding warnings about accessing a single socket from multiple threads. Added information to Tutorial 4 on sending non-integer data across platforms. 1999.03.01 Fixed a bug in basic-client.cpp from Example 10. Thanks for the bug catch go to Jerome Jacobsen. 1999.02.23 Made a minor update to Question 2.10. Added Question 2.14, having to do with timeouts and blocking Winsock functions. 1999.02.21 Updated the OS/2 entry in Question 1.6. 1999.02.16 Reworked Introduction page to be part of the main FAQ (Section 0). 1999.01.04 Added the basic-server example to Example 10. 1998.12.24 Added a few items to the BSD sockets compatibility tutorial. 1998.12.14 Fixed a problem with Question 2.8, and generally improved the answer to that question and to Question 2.12. 1998.11.24 Added the first "basic Winsock client" example program. More clients and also some server programs will follow in the series. 1998.11.22 Touched up several FAQ entries that refered to other people's copy of the Lame List to point to the version I just added. 1998.11.20 Added a copy of The Lame List to the Tutorials section. Must reading! Several minor changes, especially to the newer items added on the sixth of this month. 1998.11.06 Added Tutorial 5, which introduces the reader to the
black magic of low-level TCP debugging. In particular, it covers the
netstat tool and the TCP/IP state/transition diagram Reworked Question 2.9 a bit as a result of the new Tutorial. (It used to be called "How can I debug my Winsock program?", for example. Clearly inappropriate given the new material, and what the Question actually covered.) Updated Question 2.8. The new Answer is more cosmopolitan in its advice, and it also addresses abnormal-disconnect issues, whereas the previous Answer only covered normal disconnects. 1998.10.26 Added Question 2.12, having to do with the proper way to close a socket. Added Question 2.13, regarding MFC's CAsyncSocket and CSocket classes. Added Question 3.18, regarding a method to bypass the routing layer on a machine with multiple network interfaces. Added Question 3.19, which is about using SOCKS to drill through a firewall. Added Question 3.20, regarding whether it is a good plan to call bind() in a client program. Numerous other minor updates. 1998.09.27 Added support for changing the TTL value to the raw sockets ping program. 1998.09.19 Updated the much-neglected Section 1. I just discovered that Question 2.12, which I added almost two months ago, is essentially identical to Question 2.2. You know your FAQ is getting big when.... Anyway, I nixed Question 2.12, and used its text in place of the less-well-written 2.2 text. 1998.09.07 Added Reviews section, and wrote the first five book reviews for it. 1998.08.23 Added Questions 3.16 and 3.17, regarding issues of "how many sockets can Winsock handle". 1998.08.01 Added Tutorial 3. This material largely supercedes Questions 3.4 and 3.7, so those items have also changed. Turned Questions 2.12 and 2.13 into Tutorial 4. Added a new Question 2.12, regarding how to speak various common protocols, like HTTP and FTP. Added a new Question 3.4, regarding using the SNMP API for accessing the routing table, the ARP table, the interface list, etc. (It replaces the old Question 3.4, which was superceded by Tutorial 3.) Updated several of the entries regarding Windows 98. 1998.07.31 Added two more network monitoring packages to the Debugging portion of the FAQ's Resources section. Replaced Tutorial 2 with a new, completely-rewritten version. 1998.05.19 and 1998.05.20 Improved the wording of Question 3.15. 1998.04.28 Fixed a broken link. 1998.04.19 Updated Question 1.9 and also the Resources section. 1998.03.23 Added info on structure-padding issues to Question 2.13. Updated Question 2.10 by removing the rumor that FormatMessage can return error messages for Winsock error numbers. I have since found out that at best this is undocumented behavior that only works on one or two of Microsoft's Winsock implementations. It is by no means a universal thing. 1998.03.22 Split Resources page up so that each sub-section has its own page. Put the index pages for all the sections with their own directory in that directory. Now, the HTML file of the same name is just a redirector. For example, the old examples.html file is now at examples/index.html, and examples.html automatically forwards you to the new page. Added a few new sniffers to the Debugging Resources subsection and updated most of the the existing entries. 1998.02.23 Added a bit of info to the Get Interface List example. Added a bug note to the Get MAC Address (NetBIOS version) example. 1998.02.16 Added Questions 3.13 and 3.14, concerning raw sockets and such. Also updated Question 3.1 to reference the new questions for more information. Added Question 3.15, concerning the time and place for turning off the Nagle algorithm. Added a number of glossary entries. 1998.02.14 Added the "raw ping" example. Also touched up the answers to questions 3.1, 3.2, 3.8 and 1.7. 1998.02.02 Added a new tutorial, Winsock for the Impatient. Updated the Glossary some, mainly the router, gateway and bridge entries and other related things. 1998.02.01 Updated Questions 1.3 and 1.8 with better Winsock 2 info. Expanded Question 3.9 and split it up into Questions 3.9 through 3.11. Because they are all related, I didn't put the new questions at the end of the list, as I usually do. Instead, the old Question 3.10 is now Question 3.12. Had one of those periodic whole-FAQ editing fits, and ended up re-working a lot of the text, partly for accuracy, partly to fill in missing detail, and partly just so that it reads better. 1998.01.31 Fixed a minor problem in Question 3.8. Added Question 2.10, which explains how to get a readable error message from a Winsock error number. Added Question 2.11, which sheds some light on the poorly-understood WSAEWOULDBLOCK error. Added Question 2.12, which deals with the common misconceptions about how TCP "should" work versus how it actually does work. Added Question 2.13, which talks about "network order" for integers. Added Question 3.9, which deals with the behavior of asynchronous sockets in a multithreaded program. Added Question 3.10, which explains how to tell if the modem is connected on systems with dial-up networking. Added the "get interfaces" example. 1998.01.19 Added the Tutorials section. The first one is the information from the way-too-long answer to Question 2.4, in article format. The new answer to Question 2.4 mainly just summarizes the article and points readers to it for more information. 1998.01.17 Added Winsock debugging tools section to Resources page. Added Question 2.9 to introduce the new debugging tools section. 1998.01.16 Updated the Introduction page significantly. If you haven't read through it recently, you may want to give it a quick skim, especially the "future directions" section and the short-and-unoriginal legal statement. 1998.01.12 Updated Question 2.7 to be correct some misconceptions present in earlier versions. Expanded and reorganized the Resources section significantly. Clarified and enhanced Question 1.6. 1998.01.04 Added the "get MAC address" examples (NetBIOS and RPC methods). Also added Question 3.8 to introduce those examples. Enhanced Question 3.1, adding more details about the support for raw sockets on Microsoft and other Winsock implementations. Split Question 2.4 into Questions 2.4a, 2.4b, and
2.4c. Each part is now greatly enhanced, resulting in a much broader and
tolerant answer. [Obsolete 1997.10.27 Added some info to Question 3.3. Also changed the wording to use Microsoft's preferred term "process" rather than "task." 1997.10.09 Added the Glossary 1997.10.07 Added this list. Improved answer to Question 2.3, including a second method for getting the local IP address, and adding some caveats to the first method. Refined answer to Question 2.4, making the distinction between non-blocking and blocking sockets. What was previously called non-blocking is now called "asynchronous". (This was not incorrect, just imprecise.) Also corrected some misconceptions about the behavior of blocking sockets. 1997.08.14 First announcement for the FAQ posted to Usenet. |
Last modified on 6 July 2000 at 02:55 UTC-7 | Please send corrections to tangent@cyberport.com. |
< Go to the main FAQ page |
|
<<< Go to my Home Page |