test completed
This commit is contained in:
parent
464b661bd7
commit
15aa4ec967
@ -1,7 +1,6 @@
|
|||||||
use std::string;
|
use std::string;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub struct HandShake<'a> {
|
pub struct HandShake<'a> {
|
||||||
len_pack: u8,
|
len_pack: u8,
|
||||||
len_dom: u8,
|
len_dom: u8,
|
||||||
|
@ -31,6 +31,8 @@ impl<'a> Client<'a> {
|
|||||||
pub fn to_string(&self){
|
pub fn to_string(&self){
|
||||||
println!("len_pack {}", self.hs.getHostName());
|
println!("len_pack {}", self.hs.getHostName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//pub get_hostname(buf &mod)
|
||||||
|
|
||||||
fn join_conexions_mutex(c1: Arc<Mutex<TcpStream>>,
|
fn join_conexions_mutex(c1: Arc<Mutex<TcpStream>>,
|
||||||
c2: Arc<Mutex<TcpStream>>,
|
c2: Arc<Mutex<TcpStream>>,
|
||||||
|
14
src/main.rs
14
src/main.rs
@ -15,10 +15,18 @@ fn main() {
|
|||||||
stream.flush();*/
|
stream.flush();*/
|
||||||
println!("Go!");
|
println!("Go!");
|
||||||
let leng = stream.read(&mut buf).unwrap();
|
let leng = stream.read(&mut buf).unwrap();
|
||||||
println!("{}", leng);
|
println!("{}", buf[6]);
|
||||||
if buf[0] < 200 {
|
if buf[0] < 200 {
|
||||||
buf[(buf[0]-1) as usize] += 2;
|
let mut sstream;
|
||||||
let mut sstream = TcpStream::connect("127.0.0.1:25565").unwrap();
|
|
||||||
|
if buf[6]==49 {
|
||||||
|
buf[(buf[0]-1) as usize] -= 2;
|
||||||
|
sstream = TcpStream::connect("127.0.0.1:25565").unwrap();
|
||||||
|
} else {
|
||||||
|
buf[(buf[0]-1) as usize] -= 1;
|
||||||
|
sstream = TcpStream::connect("127.0.0.1:25566").unwrap();
|
||||||
|
}
|
||||||
|
//let mut sstream = TcpStream::connect("127.0.0.1:25565").unwrap();
|
||||||
sstream.write(&buf[.. leng]);
|
sstream.write(&buf[.. leng]);
|
||||||
let c1 = client::Client::new(stream,sstream, &buf);
|
let c1 = client::Client::new(stream,sstream, &buf);
|
||||||
c1.to_string();
|
c1.to_string();
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user