Ice.Connection

class Ice.Connection

Bases: object

Represents a connection that uses the Ice protocol.

abort() None

Aborts this connection.

close() Awaitable[None]

Starts a graceful closure of this connection once all outstanding invocations have completed.

Returns:

A future that becomes available when the connection is closed.

Return type:

Awaitable[None]

createProxy(identity: Ice.Identity) Ice.ObjectPrx

Creates a special proxy (a ‘fixed proxy’) that always uses this connection.

Parameters:

identity (Ice.Identity) – The identity of the target object.

Returns:

A fixed proxy with the provided identity.

Return type:

Ice.ObjectPrx

disableInactivityCheck() None

Disables the inactivity check on this connection.

By default, Ice will close connections that remain idle for a certain period. This method disables that behavior for this connection.

flushBatchRequests(compress: Ice.CompressBatch) None

Flushes any pending batch requests for this connection.

This corresponds to all batch requests invoked on fixed proxies associated with the connection.

Parameters:

compress (Ice.CompressBatch) – Specifies whether or not the queued batch requests should be compressed before being sent over the wire.

flushBatchRequestsAsync(compress: Ice.CompressBatch) Awaitable[None]

Flushes any pending batch requests for this connection asynchronously.

This corresponds to all batch requests invoked on fixed proxies associated with the connection.

Parameters:

compress (Ice.CompressBatch) – Specifies whether or not the queued batch requests should be compressed before being sent over the wire.

Returns:

A future that becomes available when the flush completes.

Return type:

Awaitable[None]

getAdapter() Ice.ObjectAdapter | None

Gets the object adapter associated with this connection.

Returns:

The object adapter associated with this connection.

Return type:

Ice.ObjectAdapter or None

getEndpoint() Endpoint

Gets the endpoint from which the connection was created.

Returns:

The endpoint from which the connection was created.

Return type:

Ice.Endpoint

getInfo() Ice.ConnectionInfo

Returns the connection information.

Returns:

The connection information.

Return type:

Ice.ConnectionInfo

setAdapter(adapter: Ice.ObjectAdapter | None) None

Associates an object adapter with this connection.

When a connection receives a request, it dispatches this request using its associated object adapter. If the associated object adapter is None, the connection rejects any incoming request with an ObjectNotExistException.

Parameters:

adapter (Ice.ObjectAdapter or None) – The object adapter to associate with this connection.

setBufferSize(rcvSize: int, sndSize: int) None

Sets the size of the receive and send buffers.

Parameters:
  • rcvSize (int) – The size of the receive buffer.

  • sndSize (int) – The size of the send buffer.

setCloseCallback(callback: Callable[[Connection], None]) None

Sets a close callback on the connection.

The callback is called by the connection when it’s closed. The callback is called from the Ice thread pool associated with the connection.

Parameters:

callback (Callable) – The close callback function.

throwException() None

Throws an exception that provides the reason for the closure of this connection.

For example, this function throws CloseConnectionException when the connection was closed gracefully by the peer; it throws ConnectionAbortedException when the connection is aborted. This function does nothing if the connection is not yet closed.

toString() str

Returns a description of the connection as human readable text.

This function is suitable for logging or error messages and remains usable after the connection is closed or aborted.

Returns:

The description of the connection as human readable text.

Return type:

str

type() str

Returns the connection type.

This corresponds to the endpoint type, such as ‘tcp’, ‘udp’, etc.

Returns:

The type of the connection.

Return type:

str