---
title: "Oneway Invocations"
url: https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Oneway Invocations

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode/oneway-invocations/swift.md).

A oneway invocation is an invocation made with a oneway proxy, a proxy whose [invocation mode](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-mode.md) is oneway. It sends the request without waiting for a reply, and completes as soon as the client's local transport accepts the request. For example, a client reports readings to a weather station:

> **C++, Java, JavaScript, MATLAB, PHP, Python, Ruby, and Swift**
>
> ```slice
> struct AtmosphericConditions
> {
>     double temperature;
>     double humidity;
>     double pressure;
> }
>
> interface WeatherStation
> {
>     ["oneway"]
>     void report(string sensorId, string timeStamp, AtmosphericConditions reading);
> }
> ```

> **C#**
>
> ```slice
> struct AtmosphericConditions
> {
>     double temperature;
>     double humidity;
>     double pressure;
> }
>
> interface WeatherStation
> {
>     ["oneway", "cs:identifier:Report"]
>     void report(string sensorId, string timeStamp, AtmosphericConditions reading);
> }
> ```

The [oneway](https://docs.zeroc.com/ice/3.8/slice/slice-metadata-directives.md#oneway) metadata directive is optional: it makes sure that clients invoke `report` only with a oneway, datagram, or batch proxy.

`ice_oneway` returns a oneway proxy, and an invocation on this proxy is a oneway invocation:

> **C++**
>
> ```cpp
> WeatherStationPrx oneway = weatherStation.ice_oneway();
> oneway.report(sensorId, timeStamp, reading);
> ```

> **C#**
>
> ```csharp
> WeatherStationPrx oneway = WeatherStationPrxHelper.uncheckedCast(weatherStation.ice_oneway());
> await oneway.ReportAsync(sensorId, timeStamp, reading);
> ```

> **Java**
>
> ```java
> WeatherStationPrx oneway = weatherStation.ice_oneway();
> oneway.report(sensorId, timeStamp, reading);
> ```

> **JavaScript**
>
> ```js
> const oneway = weatherStation.ice_oneway();
> await oneway.report(sensorId, timeStamp, reading);
> ```

> **MATLAB**
>
> ```matlab
> oneway = weatherStation.ice_oneway();
> oneway.report(sensorId, timeStamp, reading);
> ```

> **PHP**
>
> ```php
> $oneway = $weatherStation->ice_oneway();
> $oneway->report($sensorId, $timeStamp, $reading);
> ```

> **Python**
>
> ```py
> oneway = weatherStation.ice_oneway()
> await oneway.reportAsync(sensorId, timeStamp, reading)
> ```

> **Ruby**
>
> ```ruby
> oneway = weatherStation.ice_oneway()
> oneway.report(sensorId, timeStamp, reading)
> ```

> **Swift**
>
> ```swift
> let oneway = weatherStation.ice_oneway()
> try await oneway.report(sensorId: sensorId, timeStamp: timeStamp, reading: reading)
> ```

A oneway invocation reports the errors that occur before the local transport accepts the request, such as a failure to establish a connection. It reports no error after this point, including when the connection fails or the dispatch fails.

The server dispatches a oneway request like any other request; `Current.requestId` is `0` for a oneway request.

If the server does not keep up with the client, the client's transport buffers fill up and a synchronous oneway invocation blocks until there is room. An asynchronous oneway invocation does not block.

On the server side, Ice reads the oneway requests received on a connection in the order the client sent them. A thread pool with several threads dispatches these requests concurrently, which loses this order. To dispatch the requests of a connection one at a time, in order, see [Serializing the Messages of Each Connection](https://docs.zeroc.com/ice/3.8/runtime/threading-model/thread-pools.md#serializing-the-messages-of-each-connection).
