SCTP Discussions

Text archives Help


[SCTP-Discussion] UDP style


Chronological Thread 
  • From: Torbjorn Andersson <tora AT cs.kau.se>
  • To: discussion AT sctp.de
  • Subject: [SCTP-Discussion] UDP style
  • Date: Wed Jul 3 15:52:00 2002
  • List-id: SCTP Discussions <discussion.sctp.de>

I'm testing the explicit assoc shutdown feature of the udp style socket.

With the function below I send a empty message with only the sinfo_flag, set
to MSG_EOF, and sinfo_assoc_id set to the target assoc ID.

Saidly this don't work and I'm not sure that I use the socket in a valid way.
Can you please take a look at this code and notify me if I have overseen
something.

Thanks Torbjörn

--- Code ---

id closeAssoc(int socket, int assocID)
{
ssize_t nr;
struct msghdr msg[1];
struct cmsghdr *cmsg;
char cbuf[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
struct sctp_sndrcvinfo *sri;
size_t cmsglen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo));

/* Set up the msghdr structure for receiving */
memset(msg, 0, sizeof (*msg));
msg->msg_name = NULL;
msg->msg_namelen = 0;
msg->msg_control = cbuf;
msg->msg_controllen = cmsglen;
msg->msg_flags = 0;

msg->msg_iov = NULL;
msg->msg_iovlen = 0;

cmsg = (struct cmsghdr*)CMSG_FIRSTHDR(msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(*sri));
cmsg->cmsg_level = IPPROTO_SCTP;
cmsg->cmsg_type = SCTP_SNDRCV;

sri = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);

sri->sinfo_assoc_id = assocID;
sri->sinfo_flags = MSG_EOF;

ext_sendmsg(socket,msg,0);

}




Archive powered by MHonArc 2.6.19+.

Top of page