TCP/IP Sockets in C
Practical Guide for Programmers
The Morgan Kaufmann Practical Guides Series
Series Editor: Michael J. Donahoo
TCP/IP Sockets in C: Practical Guide for Programmers
Michael J. Donahoo and Kenneth L. Calvert
TCP/IP Sockets in Java: Practical Guide for Programmers
Kenneth L. Calvert and Michael J. Donahoo
JDBC: Practical Guide for Java Programmers
Gregory D. Speegle
For further information on these books and for a list of forthcoming titles,
please visit our Web site at www.mkp.com/practical.
TC P /I P SOC kets i n C
Practical G u ide for Prog ram me rs
Michael J. Donahoo
Baylor University
Kenneth L. Calvert
University of Kentucky
l~ ~4 ~
MORGAN KAUFMANN PUBLISHERS
An Imprint of Elsevier
SAN FRANCISCO SAN DIEGO NEW YORK BOSTON
LONDON SYDNEY TOKYO
Senior Editor Rick Adams
Publishing Services Manager Scott Norton
Senior Production Editor Cheri Palmer
Assistant Acquisitions Editor Karyn P. Johnson
Production Coordinator Mei Levenson
Cover Design Matt Seng, Seng Design
Cover Image Corbis Images/PictureQuest
Text Design Side by Side Studios
Composition/Illustration Windfall Software, using ZzTeX
Copyeditor Erin Milnes
Proojreader Jennifer McClain
Indexer Ty Koontz
Printer Maple Vail
Designations used by companies to distinguish their products are often claimed as
trademarks or registered trademarks. In all instances in which Morgan Kaufmann
Publishers is aware of a claim, the product names appear in initial capital or all
capital letters. Readers, however, should contact the appropriate companies for more
complete information regarding trademarks and registration.
Morgan Kaufmann Publishers
An Imprint of Elsevier
340 Pine Street, Sixth Floor
San Francisco, CA 94104-3205
www.mkp.com
9 2001 by Elsevier USA
All rights reserved.
Printed in the United States of America
Originally published as
The Pocket Guide to TCP/IP Sockets: C Version (1-55860-686-6)
06 05 5
No part of this publication may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means-electronic, mechanical, photocopying, or
otherwise-without the prior written permission f the publisher.
Library of Congress Control Number: 2001095844
ISBN-13:978-1-55860-826-9 ISBN-10:1-55860-826-5
This book is printed on acid-free paper.