0

Having an SCTP socket opened in one to many style [SOCK_SEQPACKET] I am unable to send/receive messages greater than SO_SNDBUF. This is in accordance with draft-ietf-tsvwg-sctpsocket-14.txt section 7.1.7. SO_SNDBUF, properly implemented in linux kernel module 3.16.3 net/sctp/socket.c line# 1874 and lksctp userspace library.

What options/strategies do I have in order to send messages greater than specified size using sctp protocol?

An example: breaking up messages on sender side and setting ppid=seq_number then re-assembling the original message on receiver side.

Community
  • 1
  • 1
Steven Varga
  • 672
  • 1
  • 7
  • 10

1 Answers1

1

You can:

  • increase SO_SNDBUF (via setsockopt() )

  • Do your own assembly/re-assembly, e.g. prepend a small header onto each packet that identifies which part of a larger frame each packet is. (There's plenty of existing protocols to draw ideas from in that regard - IP as one example which has a fragmentation mechanism) You'd just need to encode 3 values: "Start of fragment", "middle of fragment" and "last fragment". If you don't want to add this to the payload of your packets, you encode the fragmentation info in the SCTP ppid.

    Another simple way to fragment is to just send the total length on the first packet, break up the packets to be no more than SO_SNDBUF when you send them, and on the receiver you read the required number of packets until you have all data given by the initial length field. Since SCTP is already reliable, this avoids many of the quirks that you'd need in a general case. Though you must ensure all fragments are sent on the same SCTP stream.

  • Use SCTP as a single stream API (as you get with socket(AF_INTET, SOCK_STREAM, IPPROTO_SCTP);) and fragment messages in one of the ways commonly done just as if you were using TCP - e.g. by the above mentioned technique of sending a length field.

nos
  • 223,662
  • 58
  • 417
  • 506
  • observations: streams are not supported with one to many/SOCK_SEQPACKET sockets as noted in posted draft section 4.1.1; also the order is only guaranteed if set; – Steven Varga Sep 23 '14 at 22:08