[sctp-dev] Using SctpMultiChannel

Chris Hegarty chris.hegarty at oracle.com
Thu Aug 11 05:59:12 PDT 2011



On 08/11/11 01:25 PM, Johan Lübcke wrote:
> I had the same problem and I ended up doing a "send" call to the remote address. That way I get a AssociationChangeNotification with an association id that can be passed to "branch".

Yes, this would be the best way to achieve what you are looking for.

SctpMultiChannel is a little like a datagram socket, in that it can send 
and receive messages to/from remote peers without explicitly setting up 
an association, i.e. no connect is required. The class description and 
send method describe this:

   "The channel will implicitly setup a new association whenever it
    sends or receives a message from a remote peer if there is not
    already an association with that peer."

It would appear that you want SctpChannel semantics but not the overhead 
of creating a new socket for each association. But once branched the 
returned SctpChannel will be assigned its own socket.

-Chris.


> This seems a bit awkward but it works. (Especially since I need to have some actual data to send already when I want to connect to the remote side). Doing a "connect" would have been more natural.



>
> If there is a better way I am equally interested!
>
>    / Johan
>
>
> 11 aug 2011 kl. 14.03 skrev Chris:
>
>> Hi,
>>
>> I'm trying to use SctpMultiChannel to get multiple associations on the same socket (same local port/IP but different remote endpoints), but I can't for the life of me figure out the API (http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpMultiChannel.html)
>>
>> I get that I should do SctpMultiChannel.open() to create an instance and that I should bind it to my local address(es).
>> But then I want to use something like connect() (like on a regular SctpChannel), but there's no such method, or anything similar as far as I can see. And the only way to get a regular SctpChannel out of this class seems to be branch(Accociation), but that's not either an option since I  need to have an association to call that.
>>
>> What am I missing?
>>
>> TIA,
>>   Chris
>


More information about the sctp-dev mailing list