An open API service indexing awesome lists of open source software.

https://github.com/banyc/mptcp

Multipath TCP. I/O copy friendly. Split one user stream into multiple TCP streams and assemble them together into an intact stream. Graceful shutdown to prevent TCP RST.
https://github.com/banyc/mptcp

async io it-works mptcp network-programming networking tokio transport

Last synced: 4 months ago
JSON representation

Multipath TCP. I/O copy friendly. Split one user stream into multiple TCP streams and assemble them together into an intact stream. Graceful shutdown to prevent TCP RST.

Awesome Lists containing this project

README

          

# Multi-path TCP

![Session](img/session.drawio.png)

## How to transfer a file

1. Install Rust:
1. `git clone .git`
1. On the server side, run `cargo run -r -p cli --bin server -- `
- ``: The listen address
- e.g., `tcp://127.0.0.1:12345`
- e.g., `mptcp.4://127.0.0.1:12345`
- `.4`: The maximum number of TCP streams to accept
- ``: either:
- `push `: To push a file from `` to the peer
- `pull `: To pull a file from the peer to ``
1. On the client side, run `cargo run -r -p cli --bin client -- `
- ``: The server address
- e.g., `tcp://127.0.0.1:12345`
- e.g., `mptcp.4://127.0.0.1:12345`
- `.4`: The number of TCP streams to connect

## How to use MPTCP in code

Server:

```rust
let mut listener = MptcpListener::bind(addr, max_session_streams).await.unwrap();
let stream = listener.accept().await.unwrap();
let (mut read, mut write) = stream.into_split();
let mut buf = [0; 13];
read.read_exact(&mut buf).await.unwrap();
write.write_all(b"Hello client!").await.unwrap();
```

Client:

```rust
let stream = MptcpStream::connect(addr, num_streams).await.unwrap();
let (mut read, mut write) = stream.into_split();
write.write_all(b"Hello server!").await.unwrap();
let mut buf = [0; 13];
read.read_exact(&mut buf).await.unwrap();
```