diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-05-26 16:51:32 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-05-26 16:51:32 -0400 |
commit | e792fe13178fa5ec39294fc5bf53a3ecb5e43a1b (patch) | |
tree | 5da2b20bb140064f9ca7b8201176c4defa9e2601 /src/bin/iceftp.rs | |
download | ucp-e792fe13178fa5ec39294fc5bf53a3ecb5e43a1b.tar.gz ucp-e792fe13178fa5ec39294fc5bf53a3ecb5e43a1b.zip |
init repo; basic uTP send/receive
Diffstat (limited to 'src/bin/iceftp.rs')
-rw-r--r-- | src/bin/iceftp.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bin/iceftp.rs b/src/bin/iceftp.rs new file mode 100644 index 0000000..3f19dbe --- /dev/null +++ b/src/bin/iceftp.rs @@ -0,0 +1,16 @@ + +extern crate utp; + +use utp::UtpSocket; + +fn main() { + // Bind to port 3540 + let addr = "127.0.0.1:3540"; + let mut socket = UtpSocket::connect(addr).expect("Error connecting to remote peer"); + + // Send a string + socket.send_to("Hi there!".as_bytes()).expect("Write failed"); + + // Close the socket + socket.close().expect("Error closing connection"); +} |