Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: EviL_MarinE on October 24, 2004, 06:12 AM

Title: Connecting with BNLS
Post by: EviL_MarinE on October 24, 2004, 06:12 AM
Hey.

I Decided i want my bot to connect with bnls first of all, now i need some help there.

Its "bnls.valhallalegends" for server yes?
And its port "9367" yes?

Well if they are both correct, then it shud connect:

Private Sub mnuConnect_Click()
Display ChatRoom, True, True, vbYellow, "Connecting To " & frmLogin.BnlsServer
        frmMain.bnlsSocket.Close
    frmMain.bnlsSocket.Connect frmLogin.BnlsServer, 9367
End Sub


"frmMain.bnlsSocket.Connect" Bit makes it connect (duhh)
So here it is:

Private Sub bnlsSocket_Connect()
Display frmMain.ChatRoom, True, True, vbGreen, "Connected to BNLS!"
    With PBuffer
        .InsertNTString "IllusionBot"
        .SendBNLSPacket &HE
    End With
End Sub


But it doesnt start to connect, have i gone somewhere wrong with my bnls?
Title: Re: Connecting with BNLS
Post by: UserLoser. on October 24, 2004, 11:15 AM
Try using bnls.valhallalegends.com
Title: Re: Connecting with BNLS
Post by: shadypalm88 on October 24, 2004, 02:10 PM
Quote from: EviL_MarinE on October 24, 2004, 06:12 AM
Quote
Private Sub mnuConnect_Click()
Display ChatRoom, True, True, vbYellow, "Connecting To " & frmLogin.BnlsServer
        frmMain.bnlsSocket.Close
    frmMain.bnlsSocket.Connect frmLogin.BnlsServer, 9367
End Sub
Can't really see why that's wrong, try stepping through it with the debugger to see if frmLogin.BnlsServer really contains "bnls.valhallalegends.com" when it starts to connect.

And, just a tip, create a public variable in a module somewhere to hold the BNLS server address and other things like the username, password, etc.  I assume frmLogin is your settings form.  If you keep using frmLogin.Blah to access your settings, you force your bot to keep that form in memory, which is just a waste.  Not to mention that using text fields is slower than using variables.
Title: Re: Connecting with BNLS
Post by: EviL_MarinE on October 24, 2004, 02:15 PM
AH, k thanks.

Well i did just use www.valhallalegends.com in the end and it worked

Thanks for the help in other forum btw :)
Title: Re: Connecting with BNLS
Post by: Skywing on October 24, 2004, 05:52 PM
Using www.valhallalegends.com as a default is a bad idea, since your program will break if the web server ever gets moved to a different machine.
Title: Re: Connecting with BNLS
Post by: EviL_MarinE on October 25, 2004, 04:02 AM
Oh, well i did use bnls.valhallalegends.com and it didnt work, hmm

Edit: bnls.valhallalegends.com Does work now, My Apolgies :P
Title: Re: Connecting with BNLS
Post by: R.a.B.B.i.T on October 25, 2004, 08:13 PM
Not really sure if I should be talking about this here, but:
JBLS is a BNLS clone that can hash all games remotely, and uses the same protocol.  The only differences are that JBLS is a hell of a lot less efficient than BNLS, and it must be run by somebody.  You should always (even before JBLS existed) allow for the user to specify the BNLS server, but default it to bnls.valhallalegends.com.
Title: Re: Connecting with BNLS
Post by: Blaze on October 25, 2004, 08:24 PM
Stop talking about JBLS... Its not up half the time anyway....
Title: Re: Connecting with BNLS
Post by: EviL_MarinE on October 26, 2004, 06:05 AM
Heh, as i just said in my other post, i aint using BNLS Now, go to my other post (" A Problem, help plz") To see why ;\
Title: Re: Connecting with BNLS
Post by: The-FooL on October 26, 2004, 08:03 PM
Quote from: Blaze on October 25, 2004, 08:24 PM
Stop talking about JBLS... Its not up half the time anyway....
It's not up ever, at least not on a public server.
Title: Re: Connecting with BNLS
Post by: LivedKrad on October 29, 2004, 04:42 PM
You should learn to debug things, Evil Marine.
Title: Re: Connecting with BNLS
Post by: Sorc.Polgara on October 29, 2004, 10:00 PM
Hi

what is the IP for bnls.valhallalegends.com?

I am currently trying to move away from VB and make a bot in C++.  I can't seem to connect to bnls under the "bnls.valhallalegends.com" address.

I've been looking at other simple C++ bots and how they connect and it shows it connecting to BNET with its IP address instead of "useast.battle.net".

Title: Re: Connecting with BNLS
Post by: UserLoser. on October 29, 2004, 11:06 PM
Quote from: bethra on October 29, 2004, 10:00 PM
Hi

what is the IP for bnls.valhallalegends.com?

Start->Run->cmd->nslookup bnls.valhallalegends.com
Title: Re: Connecting with BNLS
Post by: EviL_MarinE on October 30, 2004, 04:42 AM
Quote from: LivedKrad on October 29, 2004, 04:42 PM
You should learn to debug things, Evil Marine.

Thx? :\
Title: Re: Connecting with BNLS
Post by: Zakath on October 30, 2004, 02:55 PM
Quote from: bethra on October 29, 2004, 10:00 PM
Hi

what is the IP for bnls.valhallalegends.com?

I am currently trying to move away from VB and make a bot in C++.  I can't seem to connect to bnls under the "bnls.valhallalegends.com" address.

I've been looking at other simple C++ bots and how they connect and it shows it connecting to BNET with its IP address instead of "useast.battle.net".



A properly constructed connection sequence can deal equally well with either a name or an IP address. ZakBot, for instance, can connect fine with a name like "useast.battle.net."
Title: Re: Connecting with BNLS
Post by: Newby on October 30, 2004, 03:51 PM
Quote from: bethra on October 29, 2004, 10:00 PM
Hi

what is the IP for bnls.valhallalegends.com?

I am currently trying to move away from VB and make a bot in C++.  I can't seem to connect to bnls under the "bnls.valhallalegends.com" address.

I've been looking at other simple C++ bots and how they connect and it shows it connecting to BNET with its IP address instead of "useast.battle.net".


Resolve the domain name to an IP. I suggest you look up WSAAsyncGetHostByName().

(GetHostByName() IIRC will work as well, but WSAAsync is a better bet.)
Title: Re: Connecting with BNLS
Post by: MyndFyre on October 30, 2004, 04:58 PM
As I understand it, WSAAsyncXxx does not actually perform true asynchronous communications.
Title: Re: Connecting with BNLS
Post by: Zakath on October 30, 2004, 07:15 PM
That is correct. It's only emulated, but it works well enough.

I don't use WSAAsyncGetHostByName(), though...the normal gethostbyname() has always worked for me.
Title: Re: Connecting with BNLS
Post by: Minux on October 30, 2004, 07:24 PM
Quote from: MyndFyre on October 30, 2004, 04:58 PM
As I understand it, WSAAsyncXxx does not actually perform true asynchronous communications.

http://support.microsoft.com/default.aspx?scid=kb;en-us;156749

[Edit]
A good way to find the IP of a domain is to open your command console and type
ping www.valhallalegends.com or ping bnls.valhallalegends.com
[/Edit]
Title: Re: Connecting with BNLS
Post by: MyndFyre on October 30, 2004, 08:44 PM
Quote from: Minus on October 30, 2004, 07:24 PM
Quote from: MyndFyre on October 30, 2004, 04:58 PM
As I understand it, WSAAsyncXxx does not actually perform true asynchronous communications.

http://support.microsoft.com/default.aspx?scid=kb;en-us;156749

So smart guy...  Do you realize that the KB article you gave here appies to 16-bit Windows?

Quote
Winsock Applications that issue a WSAAsyncGetHostByName() against MS real mode TCP/IP Winsock.dll receive IP address in reverse order

A Winsock application such as Internet Explorer 2.01 or Netscape 2.02 running on Windows 3.1 with MS real mode TCP/IP stack will fail to connect a remote host when the application issues a WSAAsyncGetHostByName() to resolve the remote host name to IP address. For example, WSAAsyncGetHostByName() will return "99.88.77.66" if the remote host IP address is "66.77.88.99".
(emphasis mine).

Since all of our computers nowadays use IE 2.01 on Windows 3.1, and we definitely link to 16-bit Winsock.dll as opposed to ws2_32.dll....
Title: Re: Connecting with BNLS
Post by: Zakath on October 30, 2004, 10:06 PM
You're the one who posted the link

Minus, I would almost call that a flame: don't do that again
Title: Re: Connecting with BNLS
Post by: Minux on October 30, 2004, 10:06 PM
Quote from: Zakath on October 30, 2004, 10:06 PM
You're the one who posted the link

Minus, I would almost call that a flame: don't do that again

Why what are you talking about Sir Zakath?
Title: Re: Connecting with BNLS
Post by: Zakath on October 30, 2004, 10:17 PM
Way to delete your flame before my reply went through. Good thing we've got something called browser caching.

(http://www.valhallalegends.com/zakath/deletedpost.png)
Title: Re: Connecting with BNLS
Post by: Skywing on October 31, 2004, 05:03 AM
You should use getaddrinfo() if it's available.  The best option is to create a dedicated thread to do DNS lookups, with the thread using getaddrinfo if the local Winsock supports it, or gethostbyname if there is no IPv6 support available.