mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added ability to specify server in chat-cli
This commit is contained in:
parent
f47a1fa441
commit
0f41b6cdfa
@ -1,10 +1,14 @@
|
||||
use client::{Client, Event};
|
||||
use common::{clock::Clock, comp};
|
||||
use log::{error, info};
|
||||
use std::io;
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::{
|
||||
io,
|
||||
net::{SocketAddr, ToSocketAddrs},
|
||||
str::FromStr,
|
||||
sync::mpsc,
|
||||
thread,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
const TPS: u64 = 10; // Low value is okay, just reading messages.
|
||||
|
||||
@ -30,9 +34,19 @@ fn main() {
|
||||
println!("Enter your username");
|
||||
let username = read_input();
|
||||
|
||||
println!("Enter the server address");
|
||||
let server_addr = read_input();
|
||||
|
||||
// Create a client.
|
||||
let mut client =
|
||||
Client::new(([127, 0, 0, 1], 59003), None).expect("Failed to create client instance");
|
||||
let mut client = Client::new(
|
||||
server_addr
|
||||
.to_socket_addrs()
|
||||
.expect("Invalid server address")
|
||||
.next()
|
||||
.unwrap(),
|
||||
None,
|
||||
)
|
||||
.expect("Failed to create client instance");
|
||||
|
||||
println!("Server info: {:?}", client.server_info);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user