Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: WiLD on October 18, 2003, 12:46 PM

Title: Direct Connection
Post by: WiLD on October 18, 2003, 12:46 PM
Ok this is alittle hard to explain but ill try my best. im trying to add soething to my bot (secret =P) but it needs to connects. Its meant 2 connect sorta like Stealth bot's tic tac toe.

i want it so some1 can host which calls DRhost but it needs to send its ip 2 the others for them 2 connect by calling DRconnect.

So id like some help with the code. iv tried so many times but it wont work.
MAP:
Host Invites > Whispers IP > Calls DRHost > Connecters Recive IP > Calls DRConnect

Thank you in advance
Title: Re:Direct Connection
Post by: Grok on October 18, 2003, 02:46 PM
Oh, you mean a trojan.

What you described is fine.  Have the trojan contact your listening process, which receives the connection address, then launches its own connection to the listening trojan.

Hope this helps.  And hope you burn in hell.
Title: Re:Direct Connection
Post by: UserLoser on October 18, 2003, 03:06 PM
Quote from: Grok on October 18, 2003, 02:46 PM
Oh, you mean a trojan.

What you described is fine.  Have the trojan contact your listening process, which receives the connection address, then launches its own connection to the listening trojan.

Hope this helps.  And hope you burn in hell.

Haha ;D
Title: Re:Direct Connection
Post by: Adron on October 18, 2003, 03:31 PM
Show your nonworking code.
Title: Re:Direct Connection
Post by: Banana fanna fo fanna on October 18, 2003, 07:21 PM
You won't want to hear this, but the best way is to write a UDP-based protocol to solve the problem of NAT traversal.

I wrote a working implementation in Python...I could make it a COM server if you want to use it in VB.
Title: Re:Direct Connection
Post by: WiLD on October 18, 2003, 07:33 PM
No its not a trojan if ya really want to know its a chat window. Kinda like Bnet Channels but only invited users can join and you can "DRAW" in it.

it all works untill i try to send the host's ip.
im about to redo the chat window just to make sure.

P1 Right click a user & invite > Sends invite to P2 > P2 Accepts > P1 starts hosting & chat window appears > P1 sends IP to P2 > P2 recieves IP > P2 connects to IP.
i hope that helps some understand abit more. it all works up till "P2 connects to IP".
Title: Re:Direct Connection
Post by: hismajesty on October 18, 2003, 08:06 PM
I wrote a *harmless* trojan back in the day. It wouldn't connect to anybodys computer but mine though. Still, good times.  :P
Title: Re:Direct Connection
Post by: CrAz3D on October 19, 2003, 11:12 AM
I member that, didn't it work on my computer for a little?
Title: Re:Direct Connection
Post by: hismajesty on October 19, 2003, 03:30 PM
Quote from: CrAz3D on October 19, 2003, 11:12 AM
I member that, didn't it work on my computer for a little?

I don't think so..but who knows.
Title: Re:Direct Connection
Post by: MyndFyre on October 23, 2003, 07:29 PM
Quote from: WiLD on October 18, 2003, 07:33 PM
No its not a trojan if ya really want to know its a chat window. Kinda like Bnet Channels but only invited users can join and you can "DRAW" in it.

it all works untill i try to send the host's ip.
im about to redo the chat window just to make sure.

P1 Right click a user & invite > Sends invite to P2 > P2 Accepts > P1 starts hosting & chat window appears > P1 sends IP to P2 > P2 recieves IP > P2 connects to IP.
i hope that helps some understand abit more. it all works up till "P2 connects to IP".

Part of the problem with connecting over TCP/IP is that a network user's IP address is different when you're sitting behind a firewall.  So, if I have a home network on subnet FF.FF.FF.00, and I want to invite someone to chat, here's how the exchange goes:

Me to You: (whispered via bnet) privatebotchat begin
You to Me: (whispered via bnet) privatebotchat ack send ip
Me to You: (whispered via bnet) privatebotchat ip 192.168.0.147

Your computer then tries to connect with sockets to 192.168.0.147.  Unfortunately, that's on a different subnet and behind a firewall; I wonder how many computers in the world have an IP address that begins with 192.168.0.  I know all three of mine at home do.

Part of the way to succeed with this is to use a tunneling protocol or a datagram protocol like (someone above) suggested with UDP.  Unfortunately, UDP is not absolutely reliable; messages can be lost (whereas in TCP/IP, an ACK is sent on successful receipt, or else the packet is re-sent), so you'd need to implement some kind of SEND/ACK/NACK protocol in addition to your messages.

Hth,

--Rob
Title: Re:Direct Connection
Post by: iago on October 24, 2003, 02:02 AM
192.168.0.* is default for LAN on windows, but I doubt anybody uses those for external ip.
Title: Re:Direct Connection
Post by: Tuberload on October 24, 2003, 03:58 AM
Quote from: Myndfyre on October 23, 2003, 07:29 PM
Your computer then tries to connect with sockets to 192.168.0.147.  Unfortunately, that's on a different subnet and behind a firewall; I wonder how many computers in the world have an IP address that begins with 192.168.0.  I know all three of mine at home do.
iago already answered this, but it is simple to see how many people on the internet could have an IP address that begins with this, 255...

QuotePart of the way to succeed with this is to use a tunneling protocol or a datagram protocol like (someone above) suggested with UDP.  Unfortunately, UDP is not absolutely reliable; messages can be lost (whereas in TCP/IP, an ACK is sent on successful receipt, or else the packet is re-sent), so you'd need to implement some kind of SEND/ACK/NACK protocol in addition to your messages.

Hth,

--Rob
You could implement your own packets that made sure the packet was received using UDP. When the server sends data over a UDP protocol just have it wait for a response with a seed, or something. If it does not receive that response the client did not receive the original packet. I guess that could keep bouncing back and forth though determining whether the confirmation packet was received or not.
Title: Re:Direct Connection
Post by: Adron on October 24, 2003, 05:33 AM
Quote from: Myndfyre on October 23, 2003, 07:29 PM
Part of the way to succeed with this is to use a tunneling protocol or a datagram protocol like (someone above) suggested with UDP.

I don't think UDP will help you get through firewalls at all. Trying to connect to a private IP will fail with any protocol, unless you're on a VPN with the target or similar.
Title: Re:Direct Connection
Post by: CupHead on October 24, 2003, 08:21 AM
The easiest way to avoid problems like that is to not be on a private IP yourself.  That way, you can simply ask the other party over the established connection (b.net presumably) to connect to a listening port that you've set up on your computer.  When both parties need their addresses translated, I'm not sure how to do it programatically.
Title: Re:Direct Connection
Post by: Adron on October 24, 2003, 10:51 AM
Quote from: CupHead on October 24, 2003, 08:21 AM
The easiest way to avoid problems like that is to not be on a private IP yourself.  That way, you can simply ask the other party over the established connection (b.net presumably) to connect to a listening port that you've set up on your computer.  When both parties need their addresses translated, I'm not sure how to do it programatically.

Go via a third party, look up your external IP through someone outside, or use UPnP?
Title: Re:Direct Connection
Post by: TriCk on October 26, 2003, 01:07 AM
Quote
Oh, you mean a trojan.

What you described is fine.  Have the trojan contact your listening process, which receives the connection address, then launches its own connection to the listening trojan.

Hope this helps.  And hope you burn in hell.

Well I doubt anyone will be interested in that bot anymore :P
Title: Re:Direct Connection
Post by: Banana fanna fo fanna on October 29, 2003, 09:16 PM
Quote from: Adron on October 24, 2003, 10:51 AM
Quote from: CupHead on October 24, 2003, 08:21 AM
The easiest way to avoid problems like that is to not be on a private IP yourself.  That way, you can simply ask the other party over the established connection (b.net presumably) to connect to a listening port that you've set up on your computer.  When both parties need their addresses translated, I'm not sure how to do it programatically.

Go via a third party, look up your external IP through someone outside, or use UPnP?

Can you explain UPnP?
Title: Re:Direct Connection
Post by: Freeware on October 30, 2003, 09:07 PM
UPnP is Universal Plug and Play, that all I know.

But for looking up for your external IP, just connect to useast.battle.net on port 6112 as a Telnet bot, and it will send you the text: Connection from 12.34.56.78 (whatever your IP is). That is your external IP I believe, one of my friends has DSL, and telnet worked fine for him to look it up.
Title: Re:Direct Connection
Post by: Adron on October 31, 2003, 10:26 AM
Quote from: St0rm.iD on October 29, 2003, 09:16 PM
Quote from: Adron on October 24, 2003, 10:51 AM
Go via a third party, look up your external IP through someone outside, or use UPnP?

Can you explain UPnP?

UPnP is supposed to allow your computer and router to communicate information on NAT, opening ports, port forwarding etc. I don't have any personal experience with it, but if anyone knows more exactly what is or is not possible, please post!
Title: Re:Direct Connection
Post by: Skywing on November 01, 2003, 12:30 PM
Quote from: Adron on October 31, 2003, 10:26 AM
Quote from: St0rm.iD on October 29, 2003, 09:16 PM
Quote from: Adron on October 24, 2003, 10:51 AM
Go via a third party, look up your external IP through someone outside, or use UPnP?

Can you explain UPnP?

UPnP is supposed to allow your computer and router to communicate information on NAT, opening ports, port forwarding etc. I don't have any personal experience with it, but if anyone knows more exactly what is or is not possible, please post!
I think it's what I've been seeing a lot of on the network here (many WinXP machines) - UDP broadcasts with content that looks like HTTP (what a mess... who thought of this stuff?).
Title: Re:Direct Connection
Post by: Adron on November 01, 2003, 08:21 PM
Yes, I think it's runs over a light-version of http. You never pass any big packets so there's no need for a tcp session, you just send a request and get a reply. And you can broadcast your requests.