---
name: "xs_getmsgopt"
section: "3"
platform: "linux"
package: "libxs-dev"
version: "1.2.0-2"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/xs_getmsgopt"
---

# xs\_getmsgopt(3)

retrieve message option

## NAME

xs\_getmsgopt - retrieve message option

## SYNOPSIS

**int xs\_getmsgopt (xs\_msg\_t** *\*message***, int** *option\_name***, void** *\*option\_value***, size\_t** *\*option\_len***);**

## DESCRIPTION

The *xs\_getmsgopt()* function shall retrieve the value for the option specified by the *option\_name* argument for the message pointed to by the *message* argument, and store it in the buffer pointed to by the *option\_value* argument. The *option\_len* argument is the size in bytes of the buffer pointed to by *option\_value*; upon successful completion *xs\_getsockopt()* shall modify the *option\_len* argument to indicate the actual size of the option value stored in the buffer.

The following options can be retrieved with the *xs\_getmsgopt()* function:

**XS\_MORE**

Indicates that there are more message parts to follow after the *message*. The type of this option is int. 0 means that this is the last message part of a multipart message. 1 means that more message parts will follow.

## RETURN VALUE

The *xs\_getmsgopt()* function shall return zero if successful. Otherwise it shall return -1 and set *errno* to one of the values defined below.

## ERRORS

**EINVAL**

The requested option *option\_name* is unknown, or the requested *option\_size* or *option\_value* is invalid, or the size of the buffer pointed to by *option\_value*, as specified by *option\_len*, is insufficient for storing the option value.

## EXAMPLE

**Receiving a multi-part message**.

```
xs_msg_t part;
int more;
size_t more_size = sizeof (more);
while (true) {
    /* Create an empty message to hold the message part */
    int rc = xs_msg_init (&part);
    assert (rc == 0);
    /* Block until a message is available to be received from socket */
    rc = xs_recvmsg (socket, &part, 0);
    assert (rc != -1);
    rc = getmsgopt (&part, XS_MORE, &more, &more_size);
    assert (rc == 0);
    if (more) {
      fprintf (stderr, "more\n");
    }
    else {
      fprintf (stderr, "end\n");
      break;
    }
    xs_msg_close (part);
}
```

## SEE ALSO

[**xs\_msg\_data**(3)](/xs_msg_data/3.md) [**xs\_msg\_init**(3)](/xs_msg_init/3.md) [**xs\_msg\_init\_size**(3)](/xs_msg_init_size/3.md) [**xs\_msg\_init\_data**(3)](/xs_msg_init_data/3.md) [**xs\_msg\_close**(3)](/xs_msg_close/3.md) [**xs**(7)](/xs/7.md)

## AUTHORS

This manual page was written by Chuck Remes \<**cremes@mac.com**\[1\]\>.

## NOTES

- 1\.

  cremes@mac.com

  mailto:cremes@mac.com
