-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't connect to server with unwrap()
called on Result
on a Err
value
#2
Comments
Please provide more client-side related information, such as the client-side code that triggered the issue |
i guess you want to write a minecraft proxy,could you tell me your minecraft client version? |
Last PC release, so i guess 1.18 |
I already have hands-on experience developing Minecraft bedrock server reverse proxies through rust-raknet, but I don't have this problem with you. I suggest you try the following ways to solve the problem.
Here is a piece of code I used to test the reverse proxy for your reference. async fn proxy(){
let mut listener = RaknetListener::bind("0.0.0.0:19199".parse().unwrap()).await.unwrap();
listener.listen().await;
loop{
let mut client1 = listener.accept().await.unwrap();
let mut client2 = RaknetSocket::connect(&"192.168.0.12:19132".parse().unwrap()).await.unwrap();
tokio::spawn(async move {
println!("build connection");
loop{
tokio::select!{
a = client1.recv() => {
let a = match a{
Ok(p) => p,
Err(_) => {
client2.close().await.unwrap();
break;
},
};
match client2.send(&a, Reliability::ReliableOrdered).await{
Ok(p) => p,
Err(_) => {
client1.close().await.unwrap();
break;
},
};
},
b = client2.recv() => {
let b = match b{
Ok(p) => p,
Err(_) => {
client1.close().await.unwrap();
break;
},
};
match client1.send(&b, Reliability::ReliableOrdered).await{
Ok(p) => p,
Err(_) => {
client2.close().await.unwrap();
break;
},
};
}
}
}
client1.close().await.unwrap();
client2.close().await.unwrap();
println!("close connection");
});
}
} I will also be testing the issues triggered by your code soon, in about a week. |
@b23r0 I tested code you provided, I see why my example didn't work, I basically blocked it with await point. But the code you provided did not seem to work, testing with MiNET server doesn't get any packets from client. and proxy doesn't receive any from client, just pointing at sky maybe it is skipping the first McPELogin packet? |
UPDATE: I got packet, don't know what because I was just logging a packet being received, but it does not work all the times, in 15-20 tries I didn't get any, don't know whats the problem |
Your test results are very different from mine. Can you provide more test information, including minecraft server version, rust-raknet version used, the operating system information of the client, and the environment configuration of the proxy you built. I've served large users through the mc proxy written by rust-raknet and im sure it works. You can contact to my discord we can continue to discuss your specific issues. |
UPDATE: I use 1.18.12 Minecraft client connect to MiNET server but raise a error. MiNET does not support Minecraft client version 1.18.x. I proxied MiNET through rust-raknet and it produced the same error. I think the problem you mentioned may be caused by MiNET, if you don't have another reply, I will close this issue. |
I've added an example that I use for reverse proxy testing. Hope it helps you. https://github.com/b23r0/rust-raknet/tree/main/example/proxy |
I just compiled the latest version of MiNET and can connect successfully with the proxy example I gave. |
Created simple packet listener, my code:
Error:
On line https://github.com/b23r0/rust-raknet/blob/main/src/socket.rs#L371
The text was updated successfully, but these errors were encountered: