简体   繁体   中英

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 )

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. Calling this function (while connected to an echo_server ) gives me this error:

getsockopt: No such file or directory

[Yes, I am using usrsctp , but I expect a similar error with sctp .]

What am I doing wrong? Or

what is the proper use of usrsctp_getsockopt for getting information (like RTO , MTU and so on)?

You have to provide an actual address in 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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