Channel-based Unidirectional Stream Protocol (CUSP)

CUSP is a reliable and secure general purpose transport designed with peer-to-peer (P2P) networking in mind. While many transport protocols have been proposed in the past, we believe ours is the first systematically designed to address the specific requirements of P2P applications. We designed CUSP for P2P partly because we believe that P2P covers the requirements of many modern network applications. P2P applications exhibit asynchronous, dynamic, and complex interactions with a large number of communication partners. We believe that many (if not most) existing Internet applications would have benefited from a protocol like CUSP during their design.

Building upon ideas from SST and SCTP, CUSP separates low-level packet management from streams into reusable channels. The stream interface allows application designers to directly express application logic in the message flow. Streams are cheap, created without a round trip and thus need not be used sparingly. As not all messages expect an immediate or direct answer, streams in CUSP are unidirectional; bidirectional streams are modelled on top of this primitive. Applications prioritize streams individually, allowing high priority streams to cut in line.

CUSP is implemented on top of UDP making it easy to deploy and reuse established NAT traversal mechanisms. The protocol also offers mobile IP support, seamlessly renegotiating channels and resuming streams. The channel layer has built-in cryptography; assured authenticity simplifies its design and cryptographic negotiation is streamlined into channel creation. Despite being feature-rich, CUSP is a simple protocol and can be implemented in comparably few lines of code.


All-Weather Transport Essentials
Christof Leng, Wesley Terpstra, Max Lehn, Robert Rehner, Alejandro Buchmann
Internet Computing, Vol. 6, No. 16, ISSN 1089-7801, IEEE, November 2012
[Journal] [BibTeX]
Designing a Testbed for Large-scale Distributed Systems
Christof Leng, Max Lehn, Robert Rehner, Alejandro Buchmann
Proceedings of ACM SIGCOMM'11, Toronto, Canada, ACM, August 2011
[Conference] [PDF] [Slides] [BibTeX]
Channel-based Unidirectional Stream Protocol (CUSP)
Wesley W. Terpstra, Christof Leng, Max Lehn, Alejandro P. Buchmann
Proceedings of the IEEE INFOCOM Mini Conference, March 2010
[Conference] [PDF] [BibTeX]

Binary Downloads

If you don't want to develop in SML, these prebuilt C++ libraries work without MLton.

Revision Linux 64-bit Linux 32-bit Windows 64-bit Windows 32-bit
r13526 tar.gz tar.gz
r13051 tar.gz tar.gz tar.gz tar.gz

Source and Documentation Downloads

To build CUSP you will need a very recent version of

MLton. The Windows installer is new enough, but you will need to build svn/HEAD for other platforms. Once you have a compiler, use one of these code snapshots:

Revision Release Date SML source Documentation (HTML) Documentation (PDF)
r13526 2009-10-31 src.tar.gz docs.tar.gz pdf
r13051 2009-09-20 src.tar.gz docs.tar.gz pdf


To reproduce performance measurements from our publications, please keep in mind these tips:

  • We only ever measure SML program performance. C++ is probably slower due to API overhead.
  • The windows versions are slower than linux, but windows 7 is faster than XP. We believe this is due to higher system call overhead.
  • Encryption and negotiation of the 64-bit builds are faster than 32-bit.
  • Under linux, use taskset to force two communicating CUSP programs to different CPUs. Otherwise linux always places them on the same CPU, halving the performance.
  • When competing versus TCP, many routers and switches penalize UDP. These devices appear to provide less buffering for UDP as compared to TCP.
A A A | Print | Contact | Legal note | Search