Skip to content
Snippets Groups Projects
Commit be590c75 authored by Covertness's avatar Covertness
Browse files

update doc

parent b2e385e2
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
//!
//! ```toml
//! [dependencies]
//! coap = "0.1.0"
//! coap = "0.2.0"
//! ```
//!
//! Then, add this to your crate root:
......@@ -56,21 +56,10 @@
//! use coap::CoAPClient;
//!
//! fn main() {
//! let addr = "127.0.0.1:5683";
//! let request = "test";
//!
//! let client = CoAPClient::new(addr).unwrap();
//! let mut packet = Packet::new();
//! packet.header.set_version(1);
//! packet.header.set_type(PacketType::Confirmable);
//! packet.header.set_code("0.01");
//! packet.header.set_message_id(1);
//! packet.set_token(vec!(0x51, 0x55, 0x77, 0xE8));
//! packet.add_option(OptionType::UriPath, request.to_string().into_bytes());
//! client.send(&packet).unwrap();
//! println!("Client request: coap://{}/{}", addr, request);
//!
//! let response = client.receive().unwrap();
//! let url = "coap://127.0.0.1:5683/Rust";
//! println!("Client request: {}", url);
//!
//! let response: Packet = CoAPClient::request(url).unwrap();
//! println!("Server reply: {}", String::from_utf8(response.payload).unwrap());
//! }
//! ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment