Original tsh code, on which my sctp port is based