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 @@ ...@@ -10,7 +10,7 @@
//! //!
//! ```toml //! ```toml
//! [dependencies] //! [dependencies]
//! coap = "0.1.0" //! coap = "0.2.0"
//! ``` //! ```
//! //!
//! Then, add this to your crate root: //! Then, add this to your crate root:
...@@ -56,21 +56,10 @@ ...@@ -56,21 +56,10 @@
//! use coap::CoAPClient; //! use coap::CoAPClient;
//! //!
//! fn main() { //! fn main() {
//! let addr = "127.0.0.1:5683"; //! let url = "coap://127.0.0.1:5683/Rust";
//! let request = "test"; //! println!("Client request: {}", url);
//! //!
//! let client = CoAPClient::new(addr).unwrap(); //! let response: Packet = CoAPClient::request(url).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();
//! println!("Server reply: {}", String::from_utf8(response.payload).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