TCP/IP Sockets in C -  Kenneth L. Calvert,  Michael J. Donahoo

TCP/IP Sockets in C (eBook)

Practical Guide for Programmers
eBook Download: PDF | EPUB
2009 | 2. Auflage
216 Seiten
Elsevier Science (Verlag)
978-0-08-092321-5 (ISBN)
Systemvoraussetzungen
Systemvoraussetzungen
24,95 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

TCP/IP Sockets in C: Practical Guide for Programmers, 2nd Edition is a quick and affordable way to gain the knowledge and skills needed to develop sophisticated and powerful web-based applications. The book's focused, tutorial-based approach enables the reader to master the tasks and techniques essential to virtually all client-server projects using sockets in C. This edition has been expanded to include new advancements such as support for IPv6 as well as detailed defensive programming strategies.

If you program using Java, be sure to check out this book's companion, TCP/IP Sockets in Java: Practical Guide for Programmers, 2nd Edition.


  • Includes completely new and expanded sections that address the IPv6 network environment, defensive programming, and the select() system call, thereby allowing the reader to program in accordance with the most current standards for internetworking.
  • Streamlined and concise tutelage in conjunction with line-by-line code commentary allows readers to quickly program web-based applications without having to wade through unrelated and discursive networking tenets.
  • Grants the reader access to online source code, which the can then be used to directly implement sockets programming procedures.


Michael J. Donahoo teaches networking to undergraduate and graduate students at Baylor University, where he is an assistant professor. He received his Ph.D. in computer science from the Georgia Institute of Technology. His research interests are in large-scale information dissemination and management.


TCP/IP Sockets in C: Practical Guide for Programmers, Second Edition is a quick and affordable way to gain the knowledge and skills needed to develop sophisticated and powerful web-based applications. The book's focused, tutorial-based approach enables the reader to master the tasks and techniques essential to virtually all client-server projects using sockets in C. This edition has been expanded to include new advancements such as support for IPv6 as well as detailed defensive programming strategies. If you program using Java, be sure to check out this book's companion, TCP/IP Sockets in Java: Practical Guide for Programmers, 2nd Edition. Includes completely new and expanded sections that address the IPv6 network environment, defensive programming, and the select() system call, thereby allowing the reader to program in accordance with the most current standards for internetworking. Streamlined and concise tutelage in conjunction with line-by-line code commentary allows readers to quickly program web-based applications without having to wade through unrelated and discursive networking tenets.

Front Cover 1
TCP/IP Sockets in C 4
Copyright Page 5
Table of Contents 6
Preface to the Second Edition 10
Chapter 1. Introduction 16
1.1 Networks, Packets, and Protocols 16
1.2 About Addresses 19
1.2.1 Writing Down IP Addresses 19
1.2.2 Dealing with Two Versions 20
1.2.3 Port Numbers 20
1.2.4 Special Addresses 21
1.3 About Names 22
1.4 Clients and Servers 22
1.5 What Is a Socket? 23
Exercises 24
Chapter 2. Basic TCP Sockets 26
2.1 IPv4 TCP Client 26
2.2 IPv4 TCP Server 32
2.3 Creating and Destroying Sockets 37
2.4 Specifying Addresses 38
2.4.1 Generic Addresses 38
2.4.2 IPv4 Addresses 39
2.4.3 IPv6 Addresses 39
2.4.4 Generic Address Storage 40
2.4.5 Binary/String Address Conversion 41
2.4.6 Getting a Socket’s Associated Addresses 41
2.5 Connecting a Socket 42
2.6 Binding to an Address 42
2.7 Handling Incoming Connections 43
2.8 Communication 45
2.9 Using IPv6 45
Exercises 47
Chapter 3. Of Names and Address Families 50
3.1 Mapping Names to Numbers 50
3.1.1 Accessing the Name Service 51
3.1.2 Details, Details 55
3.2 Writing Address-Generic Code 56
3.2.1 Generic TCP Client 58
3.2.2 Generic TCP Server 61
3.2.3 IPv4–IPv6 Interoperation 64
3.3 Getting Names from Numbers 65
Exercises 66
Chapter 4. Using UDP Sockets 68
4.1 UDP Client 69
4.2 UDP Server 72
4.3 Sending and Receiving with UDP Sockets 75
4.4 Connecting a UDP Socket 76
Exercises 77
Chapter 5. Sending and Receiving Data 78
5.1 Encoding Integers 79
5.1.1 Sizes of Integers 79
5.1.2 Byte Ordering 81
5.1.3 Signedness and Sign Extension 82
5.1.4 Encoding Integers by Hand 83
5.1.5 Wrapping TCP Sockets in Streams 86
5.1.6 Structure Overlays: Alignment and Padding 88
5.1.7 Strings and Text 91
5.1.8 Bit-Diddling: Encoding Booleans 93
5.2 Constructing, Framing, and Parsing Messages 94
5.2.1 Framing 101
5.2.2 Text-Based Message Encoding 106
5.2.3 Binary Message Encoding 109
5.2.4 Putting It All Together 111
5.3 Wrapping Up 112
Exercises 112
Chapter 6. Beyond Basic Socket Programming 114
6.1 Socket Options 114
6.2 Signals 115
6.3 Nonblocking I/O 121
6.3.1 Nonblocking Sockets 122
6.3.2 Asynchronous I/O 123
6.3.3 Timeouts 127
6.4 Multitasking 131
6.4.1 Per-Client Processes 132
6.4.2 Per-Client Thread 138
6.4.3 Constrained Multitasking 141
6.5 Multiplexing 143
6.6 Multiple Recipients 148
6.6.1 Broadcast 149
6.6.2 Multicast 152
6.6.3 Broadcast vs. Multicast 157
Exercises 157
Chapter 7. Under the Hood 158
7.1 Buffering and TCP 160
7.2 Deadlock Danger 163
7.3 Performance Implications 164
7.4 TCP Socket Life Cycle 165
7.4.1 Connecting 165
7.4.2 Closing a TCP Connection 169
7.5 Demultiplexing Demystified 173
Exercises 175
Chapter 8. Socket Programming in C++* 176
8.1 PracticalSocket Library Overview 177
8.2 Plus One Service 179
8.2.1 Plus One Server 179
8.2.2 Plus One Client 181
8.2.3 Running Server and Client 183
Exercises 183
8.3 Survey Service 183
8.3.1 Survey Support Functions 184
8.3.2 Survey Server 187
8.3.3 Survey Client 191
8.3.4 Running Server and Client 193
8.4 Survey Service, Mark 2 193
8.4.1 Socket Address Support 194
8.4.2 Socket iostream Interface 195
8.4.3 Enhanced Survey Server 196
8.4.4 Enhanced Survey Client 201
8.4.5 Administrative Client 202
8.4.6 Running Server and Clients 203
Exercises 204
References 206
Index 208

Erscheint lt. Verlag 2.3.2009
Sprache englisch
Themenwelt Informatik Netzwerke TCP / IP und IPv6
Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
ISBN-10 0-08-092321-6 / 0080923216
ISBN-13 978-0-08-092321-5 / 9780080923215
Haben Sie eine Frage zum Produkt?
PDFPDF (Adobe DRM)
Größe: 1,8 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

EPUBEPUB (Adobe DRM)
Größe: 13,0 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.