1Net::Server::Fork(3) User Contributed Perl Documentation Net::Server::Fork(3)
2
3
4
6 Net::Server::Fork - Net::Server personality
7
9 use base qw(Net::Server::Fork);
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 forks a child.
23 The child handles the request and then closes.
24
25 With the exception of parent/child signaling, this module will work
26 (with basic functionality) on Win32 systems.
27
29 check_for_dead
30 Number of seconds to wait before looking for dead children. This
31 only takes place if the maximum number of child processes
32 (max_servers) has been reached. Default is 60 seconds.
33
34 max_servers
35 The maximum number of children to fork. The server will not accept
36 connections until there are free children. Default is 256 children.
37
38 max_dequeue
39 The maximum number of dequeue processes to start. If a value of
40 zero or undef is given, no dequeue processes will be started. The
41 number of running dequeue processes will be checked by the
42 check_for_dead variable.
43
44 check_for_dequeue
45 Seconds to wait before forking off a dequeue process. It is
46 intended to use the dequeue process to take care of items such as
47 mail queues. If a value of undef is given, no dequeue processes
48 will be started.
49
51 See Net::Server.
52
54 Process flow follows Net::Server until the post_accept phase. At this
55 point a child is forked. The parent is immediately able to wait for
56 another request. The child handles the request and then exits.
57
59 The Fork server has the following hooks in addition to the hooks
60 provided by the Net::Server base class. See Net::Server
61
62 "$self->pre_accept_hook()"
63 This hook occurs just before the accept is called.
64
65 "$self->post_accept_hook()"
66 This hook occurs in the child after the accept and fork.
67
68 "$self->run_dequeue()"
69 This hook only gets called in conjunction with the
70 check_for_dequeue setting.
71
73 Since version 2.000, the Fork server has accepted the TTIN and TTOU
74 signals. When a TTIN is received, the max_servers is increased by 1.
75 If a TTOU signal is received the max_servers is decreased by 1. This
76 allows for adjusting the number of handling processes without having to
77 restart the server.
78
80 Paul Seamons <paul@seamons.com>
81
82 Rob Brown <bbb@cpan.org>
83
85 Please see also Net::Server::INET, Net::Server::PreFork,
86 Net::Server::MultiType, Net::Server::SIG Net::Server::Single
87
88
89
90perl v5.34.0 2021-07-22 Net::Server::Fork(3)