[sctp-dev] Java API for SCTP

Christopher Hegarty - Sun Microsystems Christopher.Hegarty at Sun.COM
Mon Nov 24 14:13:50 PST 2008


Hi David,

Thanks for the comments, this is a great start. Comments inline.

-Chris.

David M. Lloyd wrote:
> [snip]
> 
> OK, here's a couple first-glance comments...
> 
> 1. The *Channel classes are missing scatter/gather support.  This is 
> important in scenarios where (for example) a message must be composed, 
> but the complete message size is unknown until it has been fully 
> assembled. One allocates additional buffers as needed, rather than 
> allocating a larger buffer and copying data from the smaller buffer to 
> the larger buffer each time space is exhausted.  Admittedly not quite as 
> important is scatter support, but maybe still useful in a similar 
> scenario - allocate 10 buffers, read() only fills 4, so you pass the 
> next 6 on to the next read() operation.
Yes, I agree. scattering/gathering support would be useful. Actually, at 
one point I did have scattering/gathering support but removed it for 
simplicity. If there is a genuine case for it, which you have outlined, 
then I can certainly re-introduce it.

Of course, SCTPChannel and SCTPMultiChannel will not be able to 
implement java.nio.channels.ScatteringByteChannel or 
java.nio.channels.GatheringByteChannel. The scattering/gathering 
send/receive methods will need additional paramaters as with the current 
send/receive methods.

> 2. The notion of the Notification/NotificationHandler system being 
> specific to SCTP seems a little weird.  Are these notifications 
> synchronous or asynchronous?
Notifications from the SCTP stack are synchronous, that is, an 
AssocChangeEvent.COMM_UP must be received before any other data can be 
received on a particular association. Similarly, no more data will be 
received from an association after a ShutdownNotification has been received.

In case of SCTPChannel these notifications are useful, but not critical 
since this channel controls just a single association. For 
SctpMultiChannel these can be critical if the application needs to keep 
track of all its associations.

-Chris.

> 
> - DML



More information about the sctp-dev mailing list