Low-level API Index¶
This page lists all low-level asyncio APIs.
イベントループの取得¶
The preferred function to get the running event loop. |
|
Get an event loop instance (current or via the policy). |
|
Set the event loop as current via the current policy. |
|
Create a new event loop. |
使用例
イベントループのメソッド¶
See also the main documentation section about the event loop methods.
Lifecycle
Run a Future/Task/awaitable until complete. |
|
Run the event loop forever. |
|
イベントループを停止します。 |
|
イベントループをクローズします。 |
|
Return |
|
Return |
|
Close asynchronous generators. |
デバッグ
Enable or disable the debug mode. |
|
Get the current debug mode. |
Scheduling Callbacks
Invoke a callback soon. |
|
A thread-safe variant of |
|
Invoke a callback after the given time. |
|
Invoke a callback at the given time. |
Thread/Process Pool
|
Run a CPU-bound or other blocking function in
a |
Set the default executor for |
Tasks and Futures
Create a |
|
Schedule coroutine as a |
|
Set a factory used by |
|
Get the factory |
DNS
|
|
|
|
Networking and IPC
|
Open a TCP connection. |
|
Create a TCP server. |
Open a Unix socket connection. |
|
Create a Unix socket server. |
|
Wrap a |
|
Open a datagram (UDP) connection. |
|
|
Send a file over a transport. |
|
Upgrade an existing connection to TLS. |
|
Wrap a read end of a pipe into a |
Wrap a write end of a pipe into a |
ソケット
|
Receive data from the |
|
Receive data from the |
|
Send data to the |
|
Connect the |
|
Accept a |
|
Send a file over the |
Start watching a file descriptor for read availability. |
|
Stop watching a file descriptor for read availability. |
|
Start watching a file descriptor for write availability. |
|
Stop watching a file descriptor for write availability. |
Unix Signals
Add a handler for a |
|
Remove a handler for a |
サブプロセス
Spawn a subprocess. |
|
Spawn a subprocess from a shell command. |
エラー処理
Call the exception handler. |
|
Set a new exception handler. |
|
Get the current exception handler. |
|
The default exception handler implementation. |
使用例
Using
loop.create_connection()
to implement an echo-client.Using
loop.create_connection()
to connect a socket.
トランスポート¶
All transports implement the following methods:
トランスポートをクローズします。 |
|
トランスポートを閉じている最中か閉じていた場合 |
|
Request for information about the transport. |
|
トランスポートに新しいプロトコルを設定します。 |
|
現在のプロトコルを返します。 |
Transports that can receive data (TCP and Unix connections,
pipes, etc). Returned from methods like
loop.create_connection()
, loop.create_unix_connection()
,
loop.connect_read_pipe()
, etc:
Read Transports
Return |
|
Pause receiving. |
|
Resume receiving. |
Transports that can Send data (TCP and Unix connections,
pipes, etc). Returned from methods like
loop.create_connection()
, loop.create_unix_connection()
,
loop.connect_write_pipe()
, etc:
Write Transports
Write data to the transport. |
|
Write buffers to the transport. |
|
Return |
|
Close and send EOF after flushing buffered data. |
|
Close the transport immediately. |
|
Return high and low water marks for write flow control. |
|
Set new high and low water marks for write flow control. |
Transports returned by loop.create_datagram_endpoint()
:
データグラムトランスポート
Send data to the remote peer. |
|
Close the transport immediately. |
Low-level transport abstraction over subprocesses.
Returned by loop.subprocess_exec()
and
loop.subprocess_shell()
:
サブプロセス化されたトランスポート
Return the subprocess process id. |
|
Return the transport for the requested communication pipe (stdin, stdout, or stderr). |
|
Return the subprocess return code. |
|
サブプロセスを強制終了 (kill) します。 |
|
Send a signal to the subprocess. |
|
サブプロセスを停止します。 |
|
Kill the subprocess and close all pipes. |
プロトコル¶
Protocol classes can implement the following callback methods:
|
コネクションが作成されたときに呼び出されます。 |
|
コネクションが失われた、あるいはクローズされたときに呼び出されます。 |
|
Called when the transport's buffer goes over the high water mark. |
|
Called when the transport's buffer drains below the low water mark. |
Streaming Protocols (TCP, Unix Sockets, Pipes)
|
Called when some data is received. |
|
Called when an EOF is received. |
バッファリングされたストリーミングプロトコル
|
新しい受信バッファを割り当てるために呼び出します。 |
|
受信データによりバッファが更新された場合に呼び出されます。 |
|
Called when an EOF is received. |
データグラムプロトコル
|
Called when a datagram is received. |
|
Called when a previous send or receive operation raises an
|
サブプロセスプロトコル
|
Called when the child process writes data into its stdout or stderr pipe. |
|
子プロセスと通信するパイプのいずれかがクローズされたときに呼び出されます。 |
|
子プロセスが終了したときに呼び出されます。 |
Event Loop Policies¶
Policies is a low-level mechanism to alter the behavior of
functions like asyncio.get_event_loop()
. See also
the main policies section for more
details.
Accessing Policies
Return the current process-wide policy. |
|
Set a new process-wide policy. |
|
Base class for policy objects. |