-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
[Relay] Sendto failed with code -1 for char 5 and length 1464. #371
Comments
Please provide your code and steps to reproduce including the full console output |
|
Looks like there is no connection to the server. Try a different server. We should however not attempt to send packets where there is no connection, so this should be fixed. |
But still, I connect to the destination server and the packets are sent. |
There is no such problem when connecting to other servers (except to the server The Hive because I can't connect to it at all). |
i am pretty sure because they not allowing client to be joined with an proxy |
I get that error too but it still lets me join and nothing breaks just logs that |
I experience this aswell when using the same code (Connecting to any realm or IP/Server), although it only occurs when I use a VPN if this is any help. |
yea i noticed that aswell |
Please provide all the code if you can reproduce the issue locally. The only issue here is not logging a connection close event. It's possible you did not listen for the correct close event or did not set |
Using the code below for client const client = bedrock.createClient({
host: 'localhost', // optional
port: 19131, // optional, default 19132
username: 'Notch', // the username you want to join as, optional if online mode
offline: true // optional, default false. if true, do not login with Xbox Live. You will not be asked to sign-in if set to true.
})
let sendTime = null
let receiveTime = null
let allTimes = []
let times = 0
function sendHello () {
client.write('text', {
type: 'chat', needs_translation: false, source_name: client.username, xuid: '', platform_chat_id: '',
message: `Hello world !`
})
}
client.on('spawn', () => {
console.log('I spawned! Sending hello world...')
sendHello()
sendTime = Date.now()
})
client.on('text', (packet) => { // Listen for chat messages and echo them back.
receiveTime = Date.now()
console.log(`Latency: ${receiveTime - sendTime}ms`)
allTimes.push(receiveTime - sendTime)
times++
if (times < 10) {
sendTime = Date.now()
sendHello()
} else if (times === 10) {
console.log('Average is:', allTimes.reduce((a, b) => a + b, 0) / allTimes.length)
}
}) and for Relay const {Relay} = require('bedrock-protocol')
const relay = new Relay({
/* host and port for clients to listen to */
host: '0.0.0.0',
port: 19131,
// logging: true,
offline: true,
version: '1.20.0',
/* Where to send upstream packets to */
destination: {
host: '127.0.0.1',
port: 19130,
offline: true
}
})
relay.conLog = console.debug
relay.listen() This is what I get directly connected to vanilla server:
Connected via proxy, with minimal batching:
So we can see that the overhead is about ~2.62x, which seems OK, but definitely not great. With default batching delay it's a bit higher, but that can be fixed. I don't see anything else obvious to optimize here. Since the Relay is really designed for debugging purposes and not maximum optimization, you can look into writing your own Relay on top of the Client and Server classes and optimizing as is necessary. |
Seems like similar issue to #426 - server is closing the connection, subsequent messages fail to send. Please reopen if you have more information to add. |
got the same error, when using createClient(deviceCode login). My code: const client = await createClient({
authflow: new Authflow(gamertag, authflow_cache_manager, authflow_options),
username: gamertag,
viewDistance: 1,
connectTimeout: 10_000,
skipPing: true,
host: "geo.hivebedrock.network",
port: 19132,
offline: false
});
console.info("Connecting to The Hive..");
client.on("error", console.error);
client.on("spawn", () => {
console.info("Joined Hive");
setTimeout(() => {
client.disconnect();
console.info("Left Hive");
}, 1000 *mt_rand(5, 15));
});
client.on("disconnect", console.log) Console:
Something wierd:When connecting via Console:
|
Hello. When connecting to the server via a relay, notification data is sent to the log. What does this mean?
The text was updated successfully, but these errors were encountered: