mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
bpo-23554: Change echo server example class name from EchoServerClientProtocol to EchoServerProtocol (GH-9859)
This commit is contained in:
parent
2e438cc255
commit
43a5bd7b45
1 changed files with 2 additions and 2 deletions
|
|
@ -717,7 +717,7 @@ received data, and close the connection::
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
|
||||||
class EchoServerClientProtocol(asyncio.Protocol):
|
class EchoServerProtocol(asyncio.Protocol):
|
||||||
def connection_made(self, transport):
|
def connection_made(self, transport):
|
||||||
peername = transport.get_extra_info('peername')
|
peername = transport.get_extra_info('peername')
|
||||||
print('Connection from {}'.format(peername))
|
print('Connection from {}'.format(peername))
|
||||||
|
|
@ -740,7 +740,7 @@ received data, and close the connection::
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
|
|
||||||
server = await loop.create_server(
|
server = await loop.create_server(
|
||||||
lambda: EchoServerClientProtocol(),
|
lambda: EchoServerProtocol(),
|
||||||
'127.0.0.1', 8888)
|
'127.0.0.1', 8888)
|
||||||
|
|
||||||
async with server:
|
async with server:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue