23,217
社区成员




#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <netinet/sctp.h>
#include <errno.h>
void
Getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlenptr)
{
if (getsockopt(fd, level, optname, optval, optlenptr) < 0) {
printf("errno :%d\n", errno);
exit(0);
}
}
int
main(void)
{
int sock_fd, retsz;
struct sctp_status status;;
retsz = sizeof(int);
//bzero(&status, retsz);
sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
Getsockopt(sock_fd,IPPROTO_SCTP, SCTP_STATUS, &status, &retsz);
printf("%d\n", status.sstat_outstrms);
}
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <netinet/sctp.h>
#include <errno.h>
void
Getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlenptr)
{
if (getsockopt(fd, level, optname, optval, optlenptr) < 0) {
printf("errno :%d\n", errno);
exit(-1);
}
}
int
main(void)
{
int sock_fd, retsz;
struct sctp_status status;;
//int status;
retsz = sizeof(struct sctp_status);
/*sock_fd = socket(AF_INET, SOCK_STREAM, 0);
Getsockopt(sock_fd, SOL_SOCKET, SO_RCVBUF, &status, &retsz);
printf("%d\n", status);*/
sock_fd = socket(AF_INET,SOCK_SEQPACKET, IPPROTO_SCTP);
bzero(&status, sizeof(struct sctp_status));
Getsockopt(sock_fd, IPPROTO_SCTP, SCTP_STATUS, &status, &retsz);
printf("%d\n", status.sstat_outstrms);
}
这是全部代码 retsz = sizeof(int);
之前修改成获取缓冲区的时候,忘记修改回来了。。。