API reference
GDTCPListener
TCP listener with deadlines and Close wakeups for pending accepts.
Methods
accept() -> GDTCPConn, Erraccept_async() -> await GDTCPConn, Errset_deadline(seconds: float) -> Erraddr() -> Dictionaryis_open() -> boolclose() -> void
accept
accept() -> GDTCPConn, ErrStart accepting the next TCP connection.
Parameters
No parameters.
Return value
GDTCPConn, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
accept_async
accept_async() -> await GDTCPConn, ErrStart accepting the next TCP connection.
Parameters
No parameters.
Return value
await GDTCPConn, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
set_deadline
set_deadline(seconds: float) -> ErrSet the accept deadline in seconds from now.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
seconds | float | Required | Deadline setting in seconds; see this method for relative-time and clearing semantics. |
Return value
Err
Errors
Returns an Err object directly, not a value-and-error pair. An absent error is null; inspect the method description to distinguish creation, lookup, and stored failure.
addr
addr() -> DictionaryReturn the listen address.
Parameters
No parameters.
Return value
Dictionary
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
is_open
is_open() -> boolCheck whether the listener is open.
Parameters
No parameters.
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
close
close() -> voidClose the listener and wake all pending accepts.
Parameters
No parameters.
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.