Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(36)

Side by Side Diff: Doc/library/socketserver.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/smtplib.rst ('k') | Doc/library/sqlite3.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`socketserver` --- A framework for network servers 1 :mod:`socketserver` --- A framework for network servers
2 ======================================================= 2 =======================================================
3 3
4 .. module:: socketserver 4 .. module:: socketserver
5 :synopsis: A framework for network servers. 5 :synopsis: A framework for network servers.
6 6
7 **Source code:** :source:`Lib/socketserver.py` 7 **Source code:** :source:`Lib/socketserver.py`
8 8
9 -------------- 9 --------------
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 stream server is the address family, which is simply repeated in both Unix 74 stream server is the address family, which is simply repeated in both Unix
75 server classes. 75 server classes.
76 76
77 Forking and threading versions of each type of server can be created using the 77 Forking and threading versions of each type of server can be created using the
78 :class:`ForkingMixIn` and :class:`ThreadingMixIn` mix-in classes. For instance, 78 :class:`ForkingMixIn` and :class:`ThreadingMixIn` mix-in classes. For instance,
79 a threading UDP server class is created as follows:: 79 a threading UDP server class is created as follows::
80 80
81 class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass 81 class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
82 82
83 The mix-in class must come first, since it overrides a method defined in 83 The mix-in class must come first, since it overrides a method defined in
84 :class:`UDPServer`. Setting the various attributes also change the 84 :class:`UDPServer`. Setting the various member variables also changes the
85 behavior of the underlying server mechanism. 85 behavior of the underlying server mechanism.
86 86
87 To implement a service, you must derive a class from :class:`BaseRequestHandler` 87 To implement a service, you must derive a class from :class:`BaseRequestHandler`
88 and redefine its :meth:`handle` method. You can then run various versions of 88 and redefine its :meth:`handle` method. You can then run various versions of
89 the service by combining one of the server classes with your request handler 89 the service by combining one of the server classes with your request handler
90 class. The request handler class must be different for datagram or stream 90 class. The request handler class must be different for datagram or stream
91 services. This can be hidden by using the handler subclasses 91 services. This can be hidden by using the handler subclasses
92 :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`. 92 :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`.
93 93
94 Of course, you still have to use your head! For instance, it makes no sense to 94 Of course, you still have to use your head! For instance, it makes no sense to
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 $ python ThreadedTCPServer.py 547 $ python ThreadedTCPServer.py
548 Server loop running in thread: Thread-1 548 Server loop running in thread: Thread-1
549 Received: b"Thread-2: b'Hello World 1'" 549 Received: b"Thread-2: b'Hello World 1'"
550 Received: b"Thread-3: b'Hello World 2'" 550 Received: b"Thread-3: b'Hello World 2'"
551 Received: b"Thread-4: b'Hello World 3'" 551 Received: b"Thread-4: b'Hello World 3'"
552 552
553 553
554 The :class:`ForkingMixIn` class is used in the same way, except that the server 554 The :class:`ForkingMixIn` class is used in the same way, except that the server
555 will spawn a new process for each request. 555 will spawn a new process for each request.
OLDNEW
« no previous file with comments | « Doc/library/smtplib.rst ('k') | Doc/library/sqlite3.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+