1Net::Server::Thread(3)User Contributed Perl DocumentationNet::Server::Thread(3)
2
3
4
6 Net::Server::Thread - Net::Server personality
7
9 use base qw(Net::Server::Thread);
10
11 sub process_request {
12 #...code...
13 }
14
15 __PACKAGE__->run();
16
18 Please read the pod on Net::Server first. This module is a
19 personality, or extension, or sub class, of the Net::Server module.
20
21 This personality binds to one or more ports and then waits for a client
22 connection. When a connection is received, the server spawns a new
23 thread. The thread handles the request and then closes.
24
25 Because this Net::Server flavor spawns and destroys a thread for each
26 request, it really should only be used where the processing of each
27 request may be lengthy or involved. If short and light request are
28 used, perl may not voluntarily give back the used memory. This is
29 highly system dependent.
30
32 check_for_dead
33 Number of seconds to wait before looking for dead children. This
34 only takes place if the maximum number of child processes
35 (max_servers) has been reached. Default is 60 seconds.
36
37 max_servers
38 The maximum number of children to fork. The server will not accept
39 connections until there are free children. Default is 256 children.
40
42 See Net::Server.
43
45 Process flow follows Net::Server until the post_accept phase. At this
46 point a child is forked. The parent is immediately able to wait for
47 another request. The child handles the request and then exits.
48
50 The Fork server has the following hooks in addition to the hooks
51 provided by the Net::Server base class. See Net::Server
52
53 "$self->pre_accept_hook()"
54 This hook occurs just before the accept is called.
55
56 "$self->pre_thread_hook()"
57 This hook occurs just after accept but before the fork.
58
59 "$self->post_accept_hook()"
60 This hook occurs in the child after the accept and fork.
61
63 See Net::Server
64
66 Paul Seamons <paul@seamons.com>
67
69 Please see also Net::Server::INET, Net::Server::Fork,
70 Net::Server::PreFork, Net::Server::PreForkSimple,
71 Net::Server::MultiType, Net::Server::SIG Net::Server::Single
72
73
74
75perl v5.36.0 2023-03-17 Net::Server::Thread(3)