Jump to content
Eternal Lands Official Forums
Sign in to follow this  
themuntdregger

Deciphering server responses

Recommended Posts

Our guild has spent a lot a time developing a fairly sophisticated website for its members, which does all sorts of useful stuff, from running lotteries, skill leagues, to recording who's in-game. Something we're currently working on is a simple bot, the purpose of which is to periodically log-on to EL and spam guild news from the forum to #gm, (plus other static tasks such as checking the game-day, guild list etc).

 

The bot is coded in php and hosted on the guilds web server, hence its only designed to be in-game long enough to complete its tasks and then leave. So far, we've worked out how to connect to the EL test server, log-in and send simple commands. That part (at least) works well. Whats not so great is deciphering what the server sends back.

 

Having studied the available EL Network Protocol information, we understand that the server response is provided as a stream, where the first char is the server response code, second and third chars are used to calc the message length, with the subsequent message being terminated by a null char. However, whilst this works well enough for sending messages, trying to apply it to the server response doesn't seem to result in any sensible output.

 

Whilst decoding server responses isn't exactly vital for sending news messages to #GM, and we could just grep the response to the #day command, we'd kind of like to do things 'properly'. Therefore, any help, pointers or comments would be very gratefully received.

Share this post


Link to post
Share on other sites

Our guild has spent a lot a time developing a fairly sophisticated website for its members, which does all sorts of useful stuff, from running lotteries, skill leagues, to recording who's in-game. Something we're currently working on is a simple bot, the purpose of which is to periodically log-on to EL and spam guild news from the forum to #gm, (plus other static tasks such as checking the game-day, guild list etc).

 

The bot is coded in php and hosted on the guilds web server, hence its only designed to be in-game long enough to complete its tasks and then leave. So far, we've worked out how to connect to the EL test server, log-in and send simple commands. That part (at least) works well. Whats not so great is deciphering what the server sends back.

 

Having studied the available EL Network Protocol information, we understand that the server response is provided as a stream, where the first char is the server response code, second and third chars are used to calc the message length, with the subsequent message being terminated by a null char. However, whilst this works well enough for sending messages, trying to apply it to the server response doesn't seem to result in any sensible output.

 

Whilst decoding server responses isn't exactly vital for sending news messages to #GM, and we could just grep the response to the #day command, we'd kind of like to do things 'properly'. Therefore, any help, pointers or comments would be very gratefully received.

Messages from the server are NOT null terminated! If you need null terminated information you need to use the length information to determine where the end is.

Share this post


Link to post
Share on other sites

Our guild has spent a lot a time developing a fairly sophisticated website for its members, which does all sorts of useful stuff, from running lotteries, skill leagues, to recording who's in-game. Something we're currently working on is a simple bot, the purpose of which is to periodically log-on to EL and spam guild news from the forum to #gm, (plus other static tasks such as checking the game-day, guild list etc).

 

The bot is coded in php and hosted on the guilds web server, hence its only designed to be in-game long enough to complete its tasks and then leave. So far, we've worked out how to connect to the EL test server, log-in and send simple commands. That part (at least) works well. Whats not so great is deciphering what the server sends back.

 

Having studied the available EL Network Protocol information, we understand that the server response is provided as a stream, where the first char is the server response code, second and third chars are used to calc the message length, with the subsequent message being terminated by a null char. However, whilst this works well enough for sending messages, trying to apply it to the server response doesn't seem to result in any sensible output.

 

Whilst decoding server responses isn't exactly vital for sending news messages to #GM, and we could just grep the response to the #day command, we'd kind of like to do things 'properly'. Therefore, any help, pointers or comments would be very gratefully received.

Messages from the server are NOT null terminated! If you need null terminated information you need to use the length information to determine where the end is.

 

Thanks for that Learner. My problem is determining length information from the stream, ie the initial packet from the server looks something like �Test Server! in which case, my assumption was that the ord of the first char () would be the server message, and the ords of the two subsequent chars () would be the length information. However, this seems not to be the case.

Share this post


Link to post
Share on other sites

Our guild has spent a lot a time developing a fairly sophisticated website for its members, which does all sorts of useful stuff, from running lotteries, skill leagues, to recording who's in-game. Something we're currently working on is a simple bot, the purpose of which is to periodically log-on to EL and spam guild news from the forum to #gm, (plus other static tasks such as checking the game-day, guild list etc).

 

The bot is coded in php and hosted on the guilds web server, hence its only designed to be in-game long enough to complete its tasks and then leave. So far, we've worked out how to connect to the EL test server, log-in and send simple commands. That part (at least) works well. Whats not so great is deciphering what the server sends back.

 

Having studied the available EL Network Protocol information, we understand that the server response is provided as a stream, where the first char is the server response code, second and third chars are used to calc the message length, with the subsequent message being terminated by a null char. However, whilst this works well enough for sending messages, trying to apply it to the server response doesn't seem to result in any sensible output.

 

Whilst decoding server responses isn't exactly vital for sending news messages to #GM, and we could just grep the response to the #day command, we'd kind of like to do things 'properly'. Therefore, any help, pointers or comments would be very gratefully received.

Messages from the server are NOT null terminated! If you need null terminated information you need to use the length information to determine where the end is.

 

Thanks for that Learner. My problem is determining length information from the stream, ie the initial packet from the server looks something like �Test Server! in which case, my assumption was that the ord of the first char () would be the server message, and the ords of the two subsequent chars () would be the length information. However, this seems not to be the case.

The length is the second and third bytes and to most people it will appear to be one byte too long because the message type bytr is counted. If you aren't getting the proper length, then you might be using the bytes in the wrong order, they are in Intel byte ordering.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×