How to create an SCTP association

Bernd Walter ticso at
Thu May 1 20:43:13 UTC 2014

On Thu, May 01, 2014 at 08:07:19PM +0200, Michael Tuexen wrote:
> On 01 May 2014, at 14:49, Bernd Walter <ticso at> wrote:
> > I have an SOCK_SEQPACKET socket and want to setup an association
> > without sending a message.
> Just call connect() or sctp_connectx().

Cool - I wasn't sure about using *connect*() because tutorials only
mention it for 1to1 sockets.

> > The background is that I want to keep the round-trip times of peer
> > servers.
> > I've enabled regular heartbeat and can use SCTP_GET_PEER_ADDR_INFO
> > to get the RTT.
> > But in case a host is down or services are restarted I don't have
> > an association to ask, so I will need some way to (re)establish
> > associations.
> > This is done in a different thread as the normal socket operation,
> > which uses EOR to write.
> > If I send a (dummy)message to the socket I would have to add a mutex
> > to not disturb the sending thread.
> Does the above solve your issue?


But I have another question.
Which resources will connecting an unreachable peer use on my one to
many socket?

My use case is a distributed hash table with many servers.
Clients connect to servers via local proxy and the local proxy tries to
stay in contact with all storage nodes - basicly to keep RTT values up
to date.
I initially plan 100 nodes per cluster, 2 cluster per location and
2 location.
So such a proxy has to stay in touch with 400 peers of which 200 are
on a remote location.
Of course the remote location is rarely used, but in case of network
failure 200 peers are unreachable.
With TCP sockets the sockets are unrelated of each other.
In this case I may try to sctp_connect 200 offline peers and still
want to be able to reach the 200 local peers without additional latency.
Is there anything special to care about to not block the traffic
to the remaining peers in case a whole bunch of the others is offline?
Raising socket buffer on the proxy servers is not a problem, since
those have beafy RAM - the nodes however are tiny quad core ARM-A9 with
2G RAM only, which they mostly need to keep hashtable indexes.

B.Walter <bernd at>
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.

More information about the freebsd-net mailing list