Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Fields](https://developer.android.com/reference/android/system/StructMsghdr#lfields) \| [Ctors](https://developer.android.com/reference/android/system/StructMsghdr#pubctors) \| [Inherited Methods](https://developer.android.com/reference/android/system/StructMsghdr#inhmethods)

# StructMsghdr

*** ** * ** ***

` public final class StructMsghdr `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.system.StructMsghdr |

<br />

*** ** * ** ***

Corresponds to C's `struct msghdr`

## Summary

| ### Fields ||
|---|---|
| ` public https://developer.android.com/reference/android/system/StructCmsghdr` | `https://developer.android.com/reference/android/system/StructMsghdr#msg_control` Ancillary data |
| ` public int` | `https://developer.android.com/reference/android/system/StructMsghdr#msg_flags` Flags on received message. |
| ` public final https://developer.android.com/reference/java/nio/ByteBuffer` | `https://developer.android.com/reference/android/system/StructMsghdr#msg_iov` Scatter/gather array |
| ` public https://developer.android.com/reference/java/net/SocketAddress` | `https://developer.android.com/reference/android/system/StructMsghdr#msg_name` Optional address. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/system/StructMsghdr#StructMsghdr(java.net.SocketAddress,%20java.nio.ByteBuffer[],%20android.system.StructCmsghdr[],%20int)(https://developer.android.com/reference/java/net/SocketAddress msg_name, https://developer.android.com/reference/java/nio/ByteBuffer msg_iov, https://developer.android.com/reference/android/system/StructCmsghdr msg_control, int msg_flags) ` Constructs an instance with the given field values |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Fields

### msg_control

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StructCmsghdr[] msg_control
```

Ancillary data

<br />

### msg_flags

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int msg_flags
```

Flags on received message.

<br />

### msg_iov

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final ByteBuffer[] msg_iov
```

Scatter/gather array

<br />

### msg_name

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SocketAddress msg_name
```

Optional address.

Sendmsg: Caller must populate to specify the target address for a datagram, or pass `null` to send to the destination of an already-connected socket. Recvmsg: Populated by the system to specify the source address.

<br />

## Public constructors

### StructMsghdr

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StructMsghdr (SocketAddress msg_name, 
                ByteBuffer[] msg_iov, 
                StructCmsghdr[] msg_control, 
                int msg_flags)
```

Constructs an instance with the given field values

<br />

| Parameters ||
|---|---|
| `msg_name` | `SocketAddress`: This value may be `null`. <br /> |
| `msg_iov` | `ByteBuffer`: This value cannot be `null`. <br /> |
| `msg_control` | `StructCmsghdr`: This value may be `null`. <br /> |
| `msg_flags` | `int` <br /> |