UNIX Network Programming Volume 1, Third Edition [Electronic resources] : The Sockets Networking API نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

UNIX Network Programming Volume 1, Third Edition [Electronic resources] : The Sockets Networking API - نسخه متنی

Addison Wesley

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










Chapter 26


26.1

In the fork example, there will be 101 descriptors in use, one listening socket, and 100 connected sockets. But each of the 101 processes (one parent, 100 children) has just one descriptor open (ignoring any others, such as standard input, if the server is not daemonized). In the threaded server, however, there are 101 descriptors in the single process. Each thread (including the main thread) is handling one descriptor.

26.2

The final two segments of the TCP connection terminationthe server's FIN and the client's ACK of this FINwill not be exchanged. This leaves the client's end of the connection in the FIN_WAIT_2 state (Figure 2.4). Berkeley-derived implementations will time out the client's end when it remains in this state for just over 11 minutes (pp.825827 of TCPv2). The server will also run out of descriptors (eventually).

26.3

This message should be printed by the main thread when it reads an EOF from the socket

and the other thread is still running. A simple way to do this is to declare another external named done that is initialized to 0. Before the thread copyto returns, it sets this variable to 1. The main thread checks this variable, and if 0, prints the error message. Since only one thread sets the variable, there is no need for any synchronization.


/ 450