以下源码是基于linux操作系统的。实现了基于SCTP协议的一对多模式的服务器端代码,该段不但处理的用户数据,而且处理了的通知类的消息,即notification消息。
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static void handle_event(void *buf)
{
struct sctp_assoc_change *sac;
struct sctp_send_failed *ssf;
struct sctp_paddr_change *spc;
struct sctp_remote_error *sre;
struct sctp_shutdown_event *sse;
union sctp_notification *snp;
snp = (sctp_notification*)buf;
switch (snp->sn_header.sn_type)
{
case SCTP_ASSOC_CHANGE:
{
sac = &snp->sn_assoc_change;
printf("assoc_ch