ask for server ip
This commit is contained in:
parent
e065ddc21b
commit
9926ca5de7
19
src/main.rs
19
src/main.rs
@ -3,6 +3,7 @@ use std::{net::{UdpSocket, SocketAddr}, io::Write};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use sha3::{Digest, Sha3_512};
|
||||
use sha2::Sha512;
|
||||
use std::io::{self, BufRead};
|
||||
|
||||
mod big_array;
|
||||
use big_array::BigArray;
|
||||
@ -28,10 +29,26 @@ struct Packet {
|
||||
payload: [u8; MAX_PAYLOAD_U], //488 bytes
|
||||
} //512 bytes
|
||||
|
||||
fn read_stdin(message: String) -> String {
|
||||
print!("{}", message);
|
||||
io::stdout().flush().unwrap();
|
||||
|
||||
let mut buffer = String::new();
|
||||
let stdin = io::stdin();
|
||||
let mut handle = stdin.lock();
|
||||
|
||||
handle.read_line(&mut buffer).unwrap();
|
||||
buffer.trim().to_string()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let timeout = 1;
|
||||
let server_ip = "213.47.107.152:1337";
|
||||
let mut server_ip = read_stdin("Enter server ip: ".to_string());//e.g. 213.47.107.152:1337
|
||||
if server_ip.find(":").is_none() {
|
||||
server_ip.push_str(":1337"); //default port
|
||||
}
|
||||
|
||||
|
||||
let filename = "data.bin";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user