Top Description Constructors Methods
com.sun.nio.sctp

public abstract Class MessageInfo

extends Object
Class Inheritance
Known Direct Subclasses
sun.nio.ch.sctp.MessageInfoImpl
Imports
java.net.SocketAddress

The MessageInfo class provides additional ancillary information about messages.

Received SCTP messages, returned by SctpChannel.receive and SctpMultiChannel.receive, return a MessageInfo instance that can be queried to determine ancillary information about the received message. Messages being sent should use one of the createOutgoing methods to provide ancillary data for the message being sent, and may use the appropriate setter methods to override the default values provided for unordered, timeToLive, complete and payloadProtocolID, before sending the message.

For out going messages the timeToLive parameter is a time period that the sending side SCTP stack may expire the message if it has not been sent. This time period is an indication to the stack that the message is no longer required to be sent after the time period expires. It is not a hard timeout and may be influenced by whether the association supports the partial reliability extension, RFC 3758 .

MessageInfo instances are not safe for use by multiple concurrent threads. If a MessageInfo is to be used by more than one thread then access to the MessageInfo should be controlled by appropriate synchronization.

Since
1.7

Constructor Summary

AccessConstructor and Description
protected
MessageInfo()

Initializes a new instance of this class.

Method Summary

Modifier and TypeMethod and Description
public abstract SocketAddress

Returns:

The socket address, or null if this instance is to be used for sending a message and has been construced without specifying a preferred destination address
address
()

Returns the source socket address if the message has been received, otherwise the preferred destination of the message to be sent.

public abstract Association

Returns:

The association, or null if this instance is to be used for sending a message and has been construced using the the createOutgoing(SocketAddress,int) static factory method
association
()

Returns the association that the message was received on, if the message has been received, otherwise the association that the message is to be sent on.

public abstract int

Returns:

The number of bytes read, -1 if the channel is an SctpChannel that has reached end-of-stream, otherwise 0
bytes
()

Returns the number of bytes read for the received message.

public abstract MessageInfo

Returns:

This MessageInfo
complete
(boolean
true if, and only if, the message is complete
complete
)

Sets whether or not the message is complete.

public static MessageInfo

Returns:

The outgoing message info
createOutgoing
(SocketAddress
For a connected SctpChannel the address is the preferred peer address of the association to send the message to, or null to use the peer primary address. For an SctpMultiChannel the address is used to determine the association, or if no association exists with a peer of that address then one is setup.
address
,
int
The stream number that the message will be sent on
streamNumber
)

Creates a MessageInfo instance suitable for use when sending a message.

public static MessageInfo

Returns:

The outgoing message info
createOutgoing
(Association
The association to send the message on
association
,
SocketAddress
The preferred peer address of the association to send the message to, or null to use the peer primary address
address
,
int
The stream number that the message will be sent on.
streamNumber
)

Creates a MessageInfo instance suitable for use when sending a message to a given association.

public abstract boolean

Returns:

true if, and only if, the message is complete
isComplete
()

Tells whether or not the message is complete.

public abstract boolean

Returns:

true if the message is unordered, otherwise false
isUnordered
()

Tells whether or not the message is unordered.

public abstract int

Returns:

The Payload Protocol Identifier
payloadProtocolID
()

Returns the payload protocol Identifier.

public abstract MessageInfo

Returns:

This MessageInfo
payloadProtocolID
(int
The Payload Protocol Identifier, or 0 indicate an unspecified payload protocol identifier.
ppid
)

Sets the payload protocol Identifier.

public abstract int

Returns:

The stream number
streamNumber
()

Returns the stream number that the message was received on, if the message has been received, otherwise the stream number that the message is to be sent on.

public abstract MessageInfo

Returns:

This MessageInfo
streamNumber
(int
The stream number
streamNumber
)

Sets the stream number that the message is to be sent on.

public abstract long

Returns:

The time period in milliseconds, or 0
timeToLive
()

The time period that the sending side may expire the message if it has not been sent, or 0 to indicate that no timeout should occur.

public abstract MessageInfo

Returns:

This MessageInfo
timeToLive
(long
The time period in milliseconds, or 0 to indicate that no timeout should occur
millis
)

Sets the time period that the sending side may expire the message if it has not been sent.

public abstract MessageInfo

Returns:

This MessageInfo
unordered
(boolean
true requests the un-ordered delivery of the message, false indicates that the message is ordered.
unordered
)

Sets whether or not the message is unordered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MessageInfoback to summary
protected MessageInfo()

Initializes a new instance of this class.

Method Detail

addressback to summary
public abstract SocketAddress address()

Returns the source socket address if the message has been received, otherwise the preferred destination of the message to be sent.

Returns:SocketAddress

The socket address, or null if this instance is to be used for sending a message and has been construced without specifying a preferred destination address

associationback to summary
public abstract Association association()

Returns the association that the message was received on, if the message has been received, otherwise the association that the message is to be sent on.

Returns:Association

The association, or null if this instance is to be used for sending a message and has been construced using the the createOutgoing(SocketAddress,int) static factory method

bytesback to summary
public abstract int bytes()

Returns the number of bytes read for the received message.

This method is only appicable for received messages, it has no meaning for messages being sent.

Returns:int

The number of bytes read, -1 if the channel is an SctpChannel that has reached end-of-stream, otherwise 0

completeback to summary
public abstract MessageInfo complete(boolean complete)

Sets whether or not the message is complete.

For messages being sent true indicates that the message is complete, false indicates that the message is not complete. How the send channel interprets this value depends on the value of its SCTP_EXPLICIT_COMPLETE socket option.

Parameters
complete:boolean

true if, and only if, the message is complete

Returns:MessageInfo

This MessageInfo

See Also
MessageInfo#isComplete()
createOutgoingback to summary
public static MessageInfo createOutgoing(SocketAddress address, int streamNumber)

Creates a MessageInfo instance suitable for use when sending a message.

The returned instance will have its unordered value set to false, its timeToLive value set to 0, its complete value set to true, and its payloadProtocolID value set to 0. These values, if required, can be set through the appropriate setter method before sending the message.

Parameters
address:SocketAddress

For a connected SctpChannel the address is the preferred peer address of the association to send the message to, or null to use the peer primary address. For an SctpMultiChannel the address is used to determine the association, or if no association exists with a peer of that address then one is setup.

streamNumber:int

The stream number that the message will be sent on

Returns:MessageInfo

The outgoing message info

Exceptions
IllegalArgumentException:
If the streamNumber is negative or greater than 65536
createOutgoingback to summary
public static MessageInfo createOutgoing(Association association, SocketAddress address, int streamNumber)

Creates a MessageInfo instance suitable for use when sending a message to a given association. Typically used for SctpMultiChannel when an association has already been setup.

The returned instance will have its unordered value set to false, its timeToLive value set to 0, its complete value set to true, and its payloadProtocolID value set to 0. These values, if required, can be set through the appropriate setter method before sending the message.

Parameters
association:Association

The association to send the message on

address:SocketAddress

The preferred peer address of the association to send the message to, or null to use the peer primary address

streamNumber:int

The stream number that the message will be sent on.

Returns:MessageInfo

The outgoing message info

Exceptions
IllegalArgumentException:
If association is null, or the streamNumber is negative or greater than 65536
isCompleteback to summary
public abstract boolean isComplete()

Tells whether or not the message is complete.

For received messages true indicates that the message was completely received. For messages being sent true indicates that the message is complete, false indicates that the message is not complete. How the send channel interprets this value depends on the value of its SCTP_EXPLICIT_COMPLETE socket option.

Returns:boolean

true if, and only if, the message is complete

isUnorderedback to summary
public abstract boolean isUnordered()

Tells whether or not the message is unordered. For received messages true indicates that the message was sent non-ordered. For messages being sent true requests the un-ordered delivery of the message, false indicates that the message is ordered.

Returns:boolean

true if the message is unordered, otherwise false

payloadProtocolIDback to summary
public abstract int payloadProtocolID()

Returns the payload protocol Identifier.

A value indicating the type of payload protocol data being transmitted/received. This value is passed as opaque data by SCTP. 0 indicates an unspecified payload protocol identifier.

Returns:int

The Payload Protocol Identifier

payloadProtocolIDback to summary
public abstract MessageInfo payloadProtocolID(int ppid)

Sets the payload protocol Identifier.

A value indicating the type of payload protocol data being transmitted. This value is passed as opaque data by SCTP.

Parameters
ppid:int

The Payload Protocol Identifier, or 0 indicate an unspecified payload protocol identifier.

Returns:MessageInfo

This MessageInfo

See Also
MessageInfo#payloadProtocolID()
streamNumberback to summary
public abstract int streamNumber()

Returns the stream number that the message was received on, if the message has been received, otherwise the stream number that the message is to be sent on.

Returns:int

The stream number

streamNumberback to summary
public abstract MessageInfo streamNumber(int streamNumber)

Sets the stream number that the message is to be sent on.

Parameters
streamNumber:int

The stream number

Returns:MessageInfo

This MessageInfo

Exceptions
IllegalArgumentException:
If the streamNumber is negative or greater than 65536
timeToLiveback to summary
public abstract long timeToLive()

The time period that the sending side may expire the message if it has not been sent, or 0 to indicate that no timeout should occur. This value is only applicable for messages being sent, it has no meaning for received messages.

Returns:long

The time period in milliseconds, or 0

timeToLiveback to summary
public abstract MessageInfo timeToLive(long millis)

Sets the time period that the sending side may expire the message if it has not been sent.

Parameters
millis:long

The time period in milliseconds, or 0 to indicate that no timeout should occur

Returns:MessageInfo

This MessageInfo

See Also
MessageInfo#timeToLive()
unorderedback to summary
public abstract MessageInfo unordered(boolean unordered)

Sets whether or not the message is unordered.

Parameters
unordered:boolean

true requests the un-ordered delivery of the message, false indicates that the message is ordered.

Returns:MessageInfo

This MessageInfo

See Also
MessageInfo#isUnordered()