SHARE
TWEET

Untitled

a guest Mar 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::net::SocketAddr;
  2.  
  3.  
  4. fn main() {
  5.  
  6.     println!("YOLO UNWRAPS!!");
  7.  
  8.     let default = "127.0.0.1:10009";
  9.     let socket_addr_string = std::env::args()
  10.         .into_iter().skip(1).next()
  11.         .unwrap_or(default.to_owned());
  12.  
  13.  
  14.     let socket_addr: SocketAddr = socket_addr_string.parse().unwrap();
  15.  
  16.  
  17.     match socket_addr{
  18.         Ok(addr) =>{
  19.             let host = socket_addr.ip().to_string();
  20.         },
  21.         Err(e) => {
  22.             println!("Error parsing ip:port");
  23.  
  24.         }
  25.     }
  26.  
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top