Syllabus For The Subject TCP/IP Programming

Contents

Preface xi

PART 1 Tutorial 1

1 Introduction 3

1.1 Networks, Packets, and Protocols 3

1.2 About Addresses 5

1.3 Clients and Servers 6

1.4 What Is a Socket? 7

Thought Questions 8

2 Basic Sockets 9

2.1 Creating and Destroying 9

2.2 Specifying Addresses 10

2.3 TCP Client 1 2

2.4 TCP Server 17

Thought Questions 23

3 Constructing Messages 25

3.1 Encoding Data 26

3.2 Byte Ordering 28

3.3 Alignment and Padding 30

3.4 Framing and Parsing 31

Thought Questions 33

4.Using UDP Sockets 35

4.1 UDPClient 36

4.2 UDP Server 39

4.3 Sending and Receiving with UDP Sockets 41

Thought Questions 42

Socket Programming 43

5.1 Socket Options 43

5.2 Signals 44

5.3 Nonblocking I/O 50

5.4 Multitasking 60

5.5 Multiplexing 72

5.6 Multiple Recipients 77

Thought Questions 85

6 Under the Hood 87

6.1

6.2

6.3

6.4

6.5

Buffering and TCP 89

Deadlock 91

Performance Implications 92

TCP Socket Life Cycle 93

Demultiplexing Demystified 100

Thought Questions 102

Domain Name Service 103

7.1 Mapping Between Names and Internet Addresses

7.2 Finding Service Information by Name 106

104

PART 2 API Reference 109

API Reference 111

Data Structures 111

sockaddr 111

sockaddr_in 111

Socket Setup 112

socket() 112

bind() 112

getsockname() 113

Socket Connection 113

connect () 113

listen() 114

accept() 114

getpeername () 114

Socket Communication

send() 115

sendt o ( ) 115

recv() 116

recvfrom() 116

close() 117

shutdown() 117

115

Socket Control 118

getsockopt() 118

setsockopt() 118

Binary/String Conversion 119

inet_ntoa() 119

inet_addr() 119

htons(), htonl(), ntohs(), ntohl()

Host and Service Information

gethostname() 120

gethostbyname () 120

gethostbyaddr () 121

getservbyname () 121

getservbyport () 122

120

Bibliography 123

119

Index 125

 

DMCA.com Protection Status
Important Links : Privacy Policy | Terms & Conditions