public abstract class MessageInfo extends Object
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 SummaryConstructors Modifier Constructor Description protectedMessageInfo()Initializes a new instance of this class.
- 
Method SummaryModifier and Type Method Description abstract SocketAddressaddress()Returns the source socket address if the message has been received, otherwise the preferred destination of the message to be sent.abstract Associationassociation()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.abstract intbytes()Returns the number of bytes read for the received message.abstract MessageInfocomplete(boolean complete)Sets whether or not the message is complete.static MessageInfocreateOutgoing(Association association, SocketAddress address, int streamNumber)Creates aMessageInfoinstance suitable for use when sending a message to a given association.static MessageInfocreateOutgoing(SocketAddress address, int streamNumber)Creates aMessageInfoinstance suitable for use when sending a message.abstract booleanisComplete()Tells whether or not the message is complete.abstract booleanisUnordered()Tells whether or not the message is unordered.abstract intpayloadProtocolID()Returns the payload protocol Identifier.abstract MessageInfopayloadProtocolID(int ppid)Sets the payload protocol Identifier.abstract intstreamNumber()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.abstract MessageInfostreamNumber(int streamNumber)Sets the stream number that the message is to be sent on.abstract longtimeToLive()The time period that the sending side may expire the message if it has not been sent, or0to indicate that no timeout should occur.abstract MessageInfotimeToLive(long millis)Sets the time period that the sending side may expire the message if it has not been sent.abstract MessageInfounordered(boolean unordered)Sets whether or not the message is unordered.
- 
Constructor Details- 
MessageInfoprotected MessageInfo()Initializes a new instance of this class.
 
- 
- 
Method Details- 
createOutgoingCreates aMessageInfoinstance suitable for use when sending a message.The returned instance will have its unorderedvalue set tofalse, itstimeToLivevalue set to0, itscompletevalue set totrue, and itspayloadProtocolIDvalue set to0. These values, if required, can be set through the appropriate setter method before sending the message.- Parameters:
- address- For a connected- SctpChannelthe address is the preferred peer address of the association to send the message to, or- nullto use the peer primary address. For an- SctpMultiChannelthe address is used to determine the association, or if no association exists with a peer of that address then one is setup.
- streamNumber- The stream number that the message will be sent on
- Returns:
- The outgoing message info
- Throws:
- IllegalArgumentException- If the streamNumber is negative or greater than- 65536
 
- 
createOutgoingpublic static MessageInfo createOutgoing(Association association, SocketAddress address, int streamNumber)Creates aMessageInfoinstance suitable for use when sending a message to a given association. Typically used forSctpMultiChannelwhen an association has already been setup.The returned instance will have its unorderedvalue set tofalse, itstimeToLivevalue set to0, itscompletevalue set totrue, and itspayloadProtocolIDvalue set to0. These values, if required, can be set through the appropriate setter method before sending the message.- Parameters:
- association- The association to send the message on
- address- The preferred peer address of the association to send the message to, or- nullto use the peer primary address
- streamNumber- The stream number that the message will be sent on.
- Returns:
- The outgoing message info
- Throws:
- IllegalArgumentException- If- associationis- null, or the streamNumber is negative or greater than- 65536
 
- 
addressReturns the source socket address if the message has been received, otherwise the preferred destination of the message to be sent.- Returns:
- The socket address, or nullif this instance is to be used for sending a message and has been construced without specifying a preferred destination address
 
- 
associationReturns 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:
- The association, or nullif this instance is to be used for sending a message and has been construced using the thecreateOutgoing(SocketAddress,int)static factory method
 
- 
bytespublic 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:
- The number of bytes read, -1if the channel is anSctpChannelthat has reached end-of-stream, otherwise0
 
- 
isCompletepublic abstract boolean isComplete()Tells whether or not the message is complete.For received messages trueindicates that the message was completely received. For messages being senttrueindicates that the message is complete,falseindicates that the message is not complete. How the send channel interprets this value depends on the value of itsSCTP_EXPLICIT_COMPLETEsocket option.- Returns:
- trueif, and only if, the message is complete
 
- 
completeSets whether or not the message is complete.For messages being sent trueindicates that the message is complete,falseindicates that the message is not complete. How the send channel interprets this value depends on the value of itsSCTP_EXPLICIT_COMPLETEsocket option.- Parameters:
- complete-- trueif, and only if, the message is complete
- Returns:
- This MessageInfo
- See Also:
- isComplete()
 
- 
isUnorderedpublic abstract boolean isUnordered()Tells whether or not the message is unordered. For received messagestrueindicates that the message was sent non-ordered. For messages being senttruerequests the un-ordered delivery of the message,falseindicates that the message is ordered.- Returns:
- trueif the message is unordered, otherwise- false
 
- 
unorderedSets whether or not the message is unordered.- Parameters:
- unordered-- truerequests the un-ordered delivery of the message,- falseindicates that the message is ordered.
- Returns:
- This MessageInfo
- See Also:
- isUnordered()
 
- 
payloadProtocolIDpublic 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. 0indicates an unspecified payload protocol identifier.- Returns:
- The Payload Protocol Identifier
 
- 
payloadProtocolIDSets 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- The Payload Protocol Identifier, or- 0indicate an unspecified payload protocol identifier.
- Returns:
- This MessageInfo
- See Also:
- payloadProtocolID()
 
- 
streamNumberpublic 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:
- The stream number
 
- 
streamNumberSets the stream number that the message is to be sent on.- Parameters:
- streamNumber- The stream number
- Returns:
- This MessageInfo
- Throws:
- IllegalArgumentException- If the streamNumber is negative or greater than- 65536
 
- 
timeToLivepublic abstract long timeToLive()The time period that the sending side may expire the message if it has not been sent, or0to indicate that no timeout should occur. This value is only applicable for messages being sent, it has no meaning for received messages.- Returns:
- The time period in milliseconds, or 0
 
- 
timeToLiveSets the time period that the sending side may expire the message if it has not been sent.- Parameters:
- millis- The time period in milliseconds, or- 0to indicate that no timeout should occur
- Returns:
- This MessageInfo
- See Also:
- timeToLive()
 
 
-