Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6684557
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: C/C++

2015-12-19 15:47:34



programs.zip (所有源代码)

The Linux Socket Programming book cites several programs which were too lengthy to include entirely in the text. This page gives you access to all the complete and commented code listings.

Program Source for Book
Chapter 1: Introducing the Cookbook Client

Open a port and read server's message.

Chapter 2: TCP/IP Network Language Fluency

The Simple Client is expanded to include sending a message and selecting any port.

Chapter 3: Different Types of Internet Packets

Listen to the packets on the network.

Chapter 4: Sending Messages Between Peers

Listen to the packets on the network.

Pass messages between programs.

Display the reply to an HTTP request.

Send transaction TCP messages (T/TCP) between client and server (Linux does not yet support this protocol).

Demonstrates connecting and reconnecting using UDP.

Chapter 6: A Server Primer

Creates an HTML page from the directory listing.

Simple echo server.

Chapter 7: Dividing the Load: Multitasking

Trivial task-creation example.

Multitasked echo servers.

Examples of servers that call exec().

Various multitasked ls or directory servers.

Example showing threads with mutexes.

Chapter 8: Choosing When to Wait for I/O

Simple on-demand servlet creator.

Implementation of a connection timeout.

Chapter 9: Breaking Performance Barriers

Example of servlets that terminate if not enough activity.

Creates servlets up to a spoecified point. Keeps the host from overloading.

Balances the servlet load between tasks and select()s.

Example of how to manually determine if a server or client drops out.

Creates tasks ahead of time in anticipation of a connection.

An example to solve the dynamic connections and load problem.

Creates as many servlets as accepted connections.

Combines multitasking with select() system call.

General server tester.

Example of send and receiving urgent (out of band) messages.

Chapter 10: Designing Robust Linux Sockets

Example restarting a wayward process (WARNING: it does not always work!).

Example of getting and capturing the EPIPE signal.

Chapter 12: Using Java's Networking API

Datagram messenger

Client/server without I/O stream translation.

Client/server with I/O stream translation.

Sending and receiving objects.

Simple multicast example.

Simple datagram example.

GUI-based datagram/multicast examples.

Threaded echo server.

GUI-based socket (TCP) messenger.

General GUI error display.

IPv6-support verifier.

Chapter 13: Designing and Using a C++ Socket Framework

Entire C++ framework.

Echo client/server example.

Broadcast/multicast examples.

Dual program example for datagrams.

Peer-to-peer datagram example.

Chapter 15: Network Encapsulation with Remote Procedure Calls (RPCs)

Time Server This is a very simplified program that demonstrates passing scalar (simple) variables through an RPC connection. The rpcgen program creates all files from the .x file.







Process Table Server This program extends the types to include strings. The program's server opens a pipe to 'ps' and sends the resulting strings to the client. The new XDR file helps with data type conversion.








Linked List Server The rpcgen program allows you to create dynamic data types and send them over the communication link. It has some interesting limitations, though, which the book covers in detail.








List-Process Table Server This program merges the list and proc-table programs to create a fielded, dynamic memory process information query.








Chapter 16: Adding Security to Network Programs and SSL

The SSL (with the OpenSSL API) client/server uses the standard socket interface as the starting point, and then, it does the handshaking for a secure connection.


Chapter 17: Sharing Messages with Multicast, Broadcast, and Mbone

Broadcasting, an older method of sharing information uses the network mask to send and receive general messages. Multicast replaces broadcast as a more WAN-friendly solution. Until multicasting is fully supported on the Internet, Mbone acts as a virtual network using IP-over-IP protocols.



Chapter 18: The Power of Raw Sockets

Raw sockets permit you to experiment with nearly zero-level protocols, simplifying custom protocols.



Chapter 19: IPv6: The Next Generation to IP

When written right, converting to IPv6 from IPv4 is very simple and only requires a few changes. These examples show the few changes in socket creation and setup.
阅读(1147) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~