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

Trouble logging IN

Recommended Posts

Hello there,

 

I am making a bot In basic (or at least i am trying), and thus far I’ve managed to connect. I am receiving a ping request from the server (or so I think) immediately after my connection.

 

I try to log in and then….. BOOM…. I immediately disconnect.

 

Does anyone of you super programmers, knows why I disconnect?

 

I am using winsock. And in my attempt to log in I send to the server the message Msg$

 

 

length_of_Msg = LEN(MyName$)+ LEN(Mypassword$) +1 +1 + 1


   Msg$= CHR$(140) + CHR$(length_of_Msg) + MyName$  +  “ “  +  Mypassword$  + CHR$ (0)

 

 

I believe CHR$(0) is the NULL character correct?

 

DO I disconnect because I don’t reply to the server’s ping request? ( I’ve been completely ignoring it and going straight for the log-in.

 

Or I disconect because I'am sending nonsense to the server?

 

[EDIT]: TYPOS

Edited by giannis

Share this post


Link to post
Share on other sites

If you don't send a keepalive packet regularly (schedule a thread for once every 25 seconds) the bot will grue.

 

 

going back old school to my basic days I would have done this, hope it helps.

function login%(username$,password$)
{
l% = len(username$) + len(password$) + 3
$packet$=chr$(140) + chr$(l% mod 256) + username$ + " " + password$ + chr$(0)
login% = sendpacket%(packet$)
}

retval% = login%(username$,password$)

A quick rundown:

% means word (2 bytes, 16 bits)

$ means string (any length up to 32k)

mod means modulo (repeatedly deduct the mod value until the number is between 0 and mod value-1)

An example would be 25 mod 10 returns 5 (25-10-10)

len means length of string

 

Can't help you with the winsock stuff, all my basic coding was done in QuickBasic 7.1 PDS.

-----------------

edit: Meh why have BBCODE indent when it doesn't work? :/

Edited by LabRat

Share this post


Link to post
Share on other sites
AFAIK you need to reply to PING_REQUEST, too. Its not enough to send HEART_BEAT.

 

No, HEART_BEAT is all you need. PING, PING_REQUEST, and PING_RESPONSE have all been unused by my bot from the beginning. :)

Share this post


Link to post
Share on other sites
length_of_Msg = LEN(MyName$)+ LEN(Mypassword$) +1 +1 + 1
Msg$= CHR$(140) + CHR$(length_of_Msg) + MyName$  +  “ “  +  Mypassword$  + CHR$ (0)

length_of_Msg should be a 16 bit integer (two bytes). You can try this, it should work as long as your message is shorter than 255 bytes.

Msg$= CHR$(140) + CHR$(length_of_Msg) + CHR$(0) + MyName$  +  “ “  +  Mypassword$  + CHR$ (0)

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.

×