# Message-oriented Communication

## Message Oriented Communication (Socket)

* A **socket** is **a communication end point** to which an application can write data that are to be sent out over the underlying network, and from which incoming data can be read.
* A socket forms **an abstraction over the actual port** that is used by the local operating system for a specific transport protocol.
* Common operations include:
  * `socket`: create a new communication end point
  * `bind`: attach a local address to a socket
  * `listen`: tell operating system what the maximum number of pending connection requests should be
  * `accept`: **block caller until a connection request arrives**
  * `connect`: actively attempt to establish a connection
  * `send`: send some data over the connection
  * `receive`: receive some data over the connection
  * `close`: release the connection

## Message-Passing Interface (MPI)

* MPI is designed for **parallel applications** and as such is tailored to **transient communication**.
* Support different network protocol stacks.
* Common operations include:
  * `MPI_bsend`: append outgoing message to a local send buffer (**transient asynchronous communication**)
  * `MPI_send`: send a message and wait until copied to local or remote buffer
  * `MPI_ssend`: send a message and wait until transmission starts (**synchronous communication**)
  * `MPI_sendrecv`: send a message and wait for reply (**strongest form of synchronous communication**)
  * `MPI_isend`: pass reference to outgoing message, and continue
  * `MPI_issend`: pass reference to outgoing message, and wait until receipt starts
  * `MPI_recv`: receive a message; block if there is none
  * `MPI_irecv`: check if there is an incoming message, but do not block


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ret2basic.gitbook.io/ctfnote/computer-science/distributed-systems/communication/message-oriented-communication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
