简体   繁体   English

检索有关SCTP关联的特定对等地址的信息

[英]Retrieve information about a specific peer address of an SCTP-association

I'm trying to 我试图

retrieve information about a specific peer address of an association, including its reachability state, congestion window, and retransmission timer values. 检索有关关联的特定对等地址的信息,包括其可达性状态,拥塞窗口和重传计时器值。 ( RFC 6458, p. 82 ) RFC 6458,第82页

with this client-code snippet: 带有以下客户端代码段:

struct sctp_paddrinfo status;    
socklen_t opt_len = (socklen_t)sizeof(status);
if (usrsctp_getsockopt(sock, IPPROTO_SCTP, SCTP_GET_PEER_ADDR_INFO, &status, &opt_len) < 0) {
     perror("getsockopt");                       
}

sock is the current socket descriptor. sock是当前的套接字描述符。 Calling this function (while connected to an echo_server ) gives me this error: 调用此函数(同时连接到echo_server )会给我这个错误:

getsockopt: No such file or directory getsockopt:没有这样的文件或目录

[Yes, I am using usrsctp , but I expect a similar error with sctp .] [是的,我正在使用usrsctp ,但我希望sctp出现类似的错误。]

What am I doing wrong? 我究竟做错了什么? Or 要么

what is the proper use of usrsctp_getsockopt for getting information (like RTO , MTU and so on)? usrsctp_getsockopt用于获取信息(如RTOMTU等)的正确用法是什么?

You have to provide an actual address in status.spinfo_address 您必须在status.spinfo_address提供实际地址。

struct sockaddr_storage peer_address;
struct sockaddr_in *sin; 

memcpy(&peer_address, sin, sizeof(struct sockaddr_in));  
...
status.spinfo_address = peer_address;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM