Skip to content

A client/server protocol for using `io::Read` and `io::Seek` over a network

Notifications You must be signed in to change notification settings

jam1garner/network-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

network-reader

A client/server protocol for using io::Read and io::Seek over a network

Server example:

use network_reader::Networked;

Networked::new_buffered(File::open("my_file.txt").unwrap(), ("127.0.0.1", 4000))
    .unwrap()
    .listen()
    .unwrap();

Client example:

use network_reader::NetworkReader;

let mut reader = NetworkReader::new(("127.0.0.1", 4000)).unwrap();

// Read 4 bytes from Reader provided over the network
let mut buf = [0u8; 4];
reader.read_exact(&mut buf).unwrap();

If the two above samples were used together, the client would read the first 4 bytes from file "my_file.txt".

About

A client/server protocol for using `io::Read` and `io::Seek` over a network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages