int SCTPSock = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
//set sctp initial options
	sctp_initmsg tSCTPInitMsg;
	memset(&tSCTPInitMsg, 0, sizeof(tSCTPInitMsg));
	tSCTPInitMsg.sinit_num_ostreams = 10;
	tSCTPInitMsg.sinit_max_instreams = 20;
	int nRet = setsockopt(SCTPSock, SOL_SCTP, SCTP_INITMSG, 
					&tSCTPInitMsg, sizeof(tSCTPInitMsg));
//tell SCTP to provide information about the data messages 
//being sent across the SCTP association
	sctp_event_subscribe tSCTPSubscribe;
	memset(&tSCTPSubscribe, 0, sizeof(tSCTPSubscribe));
	tSCTPSubscribe.sctp_data_io_event = 1;
	tSCTPSubscribe.sctp_send_failure_event = 1;
	nRet = setsockopt(SCTPSock, SOL_SCTP, SCTP_EVENTS, 
					&tSCTPSubscribe, sizeof(tSCTPSubscribe));

Example 1: SCTP_INITMSG and SUBSCRIBE_EVENT. This figure demonstrates how to set the number of virtual streams for an SCTP association.

Back to Article