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.
- Host: GitHub
- URL: https://github.com/banyc/mptcp
- Owner: Banyc
- Created: 2023-10-21T11:44:26.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T06:40:35.000Z (over 1 year ago)
- Last Synced: 2025-07-27T09:42:55.255Z (6 months ago)
- Topics: async, io, it-works, mptcp, network-programming, networking, tokio, transport
- Language: Rust
- Homepage:
- Size: 114 KB
- Stars: 9
- Watchers: 2
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multi-path TCP

## 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();
```