如何将消息发送到接收过程中发现的 SCTP 协会?
我有一个套接字来接收来自多个客户端的数据。
sockfd = socket(...);
bind(sockfd, ...);
listen(sockfd, ...);
while (true) {
nread = sctp_rcvmsg(sockfd, ..., buf, ..., &info);
assoc_id = sinfo.sinfo_assoc_id;
stream = sinfo.sinfo_stream;
handle_message(assoc_id, stream, buf, nread);
}
我获取每个连接的关联 ID。我的问题是如何在关联 ID 上发送响应消息而不是使用客户端地址(例如 sctp_sendmsg 没有关联 ID 参数)
I am having an socket to receive data from multiple clients.
sockfd = socket(...);
bind(sockfd, ...);
listen(sockfd, ...);
while (true) {
nread = sctp_rcvmsg(sockfd, ..., buf, ..., &info);
assoc_id = sinfo.sinfo_assoc_id;
stream = sinfo.sinfo_stream;
handle_message(assoc_id, stream, buf, nread);
}
I get the association Id for each connection. My question is how can I send the response message on the association ID rather than using the client address(eg sctp_sendmsg doesnt have associaiton ID parameter)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 http://linux.die.net/man/3/sctp_peeloff
sctp_peeloff
将一对多样式套接字sd
上的现有关联assoc_id
分支为单独的套接字。新的套接字是一对一样式的套接字。例如,当应用程序希望在原始一对多样式套接字下保留许多零星消息发送者/接收者,但将那些携带大量数据流量的关联分支到它们自己的单独套接字描述符中时,这是特别需要的。
From http://linux.die.net/man/3/sctp_peeloff
sctp_peeloff
branches off an existing associationassoc_id
on a one-to-many style socketsd
into a separate socket. The new socket is a one-to-one style socket.This is particularly desirable when, for instance, the application wishes to have a number of sporadic message senders/receivers remain under the original one-to-many style socket, but branch off those associations carrying high volume data traffic into their own separate socket descriptors.