SCTP\_RECVMSG(3) Linux Programmer's Manual SCTP\_RECVMSG(3)

# [NAME](#NAME)

sctp\_recvmsg - Receive a message from a SCTP socket.

# [SYNOPSIS](#SYNOPSIS)

```
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>

int sctp_recvmsg(int sd, void * msg, size_t len,
                 struct sockaddr * from, socklen_t * fromlen,
                 struct sctp_sndrcvinfo * sinfo, int * msg_flags);
```

# [DESCRIPTION](#DESCRIPTION)

**sctp\_recvmsg** is a wrapper library function that can be used to receive a message from a socket while using the advanced features of SCTP. *sd* is the socket descriptor on which the message pointed to by *msg* of length *len* is received.

If *from* is not NULL, the source address of the message is filled in. The argument *fromlen* is a value-result parameter. initialized to the size of the buffer associated with *from ,* and modified on return to indicate the actual size of the address stored.

*sinfo* is a pointer to a sctp\_sndrcvinfo structure to be filled upon receipt of the message. *msg\_flags* is a pointer to a integer that is filled with any message flags like **MSG\_NOTIFICATION or** **MSG\_EOR.** The value of *msg\_flags* pointer should be initialized to 0 to avoid unexpected behavior; *msg\_flags* is also used as an input *flags* argument to *recvmsg* function.

# [RETURN VALUE](#RETURN_VALUE)

On success, **sctp\_recvmsg** returns the number of bytes received or -1 if an error occurred.

# [SEE ALSO](#SEE_ALSO)

[**sctp**(7)](/man/os/libsctp/sctp.7) [**sctp\_bindx**(3)](/man/os/libsctp/sctp_bindx.3), [**sctp\_connectx**(3)](/man/os/libsctp/sctp_connectx.3), [**sctp\_sendmsg**(3)](/man/os/libsctp/sctp_sendmsg.3), [**sctp\_sendv**(3)](/man/os/libsctp/sctp_sendv.3), [**sctp\_send**(3)](/man/os/libsctp/sctp_send.3), [**sctp\_peeloff**(3)](/man/os/libsctp/sctp_peeloff.3), [**sctp\_getpaddrs**(3)](/man/os/libsctp/sctp_getpaddrs.3), [**sctp\_getladdrs**(3)](/man/os/libsctp/sctp_getladdrs.3), [**sctp\_opt\_info**(3)](/man/os/libsctp/sctp_opt_info.3)

2005-10-25 Linux 2.6

---

Document: sctp_recvmsg(3) from libsctp 1.0.21-r4 (Chainguard OS)
Source: https://github.com/sctp/lksctp-tools
