Valhalla Legends Forums Archive | Battle.net Bot Development | A question about sockets...I think.

AuthorMessageTime
Eternal
Hi all,

Would appreciate some advice. If my DSL connection drops (which it seems to do more often than it should, but that's another problem altogether) I notice that my bot just, well sits there. It disconnects, of course, but I am unable to make it autoreconnect unless I try to hit the enter button to send some data, for example. Then, it displays the socket error code and runs the autoreconnect routine I have written. Other bots, like Stealth for example, will display this almost immediately then reconnect.

I just wondered if anyone would offer some pointers on where I should be debugging to see why this is happening. I've tried putting in a few bits of code to run if the socket state (VB6....ewww) is not connected, but it never gets to that point.

Any help much appreciated.

Thanks,

March 23, 2006, 7:44 PM
LoRd
Send keep-alive packets and monitor times between SID_PINGs when idle.
March 23, 2006, 7:52 PM
Eternal
Thanks for the reply. I do already send keep alive packets. I'm wondering though how your suggestion will help. Would you mind elaborating?

thanks,
March 23, 2006, 9:36 PM
Yegg
[quote author=Eternal link=topic=14571.msg148994#msg148994 date=1143149796]
Thanks for the reply. I do already send keep alive packets. I'm wondering though how your suggestion will help. Would you mind elaborating?

thanks,
[/quote]

http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=192

I hope you're sending the packets properly. You just need to send 0x00 once, if Battle.net sends it back then you're still connected to them. However you should take Lord's advice and record how long it takes them to respond.
March 23, 2006, 10:48 PM
Zakath
I don't monitor response time at all - networks do suffer problems that will delay responses without shutting down the socket. However, when you disconnect and attempt to send an SID_NULL, you should be immediately getting back an error response indicating the socket is no longer open.
March 23, 2006, 11:20 PM
Eternal
Thanks guys. I've monitored these suggestions and it seems I wasn't sending those packets correctly. Now that I am, once the DSL drops (or once someone removes the cable to test....) the socket error is being received properly and the bot is now reconnecting.

Thanks for your suggestions.
March 23, 2006, 11:35 PM
LoRd
[quote author=Zakath link=topic=14571.msg149017#msg149017 date=1143156053]
I don't monitor response time at all - networks do suffer problems that will delay responses without shutting down the socket.[/quote]

This is true to an extent; however you should still close the socket if no data has been received in over x number of minutes.  IIRC, Battle.net will drop an inactive connection after about 3 minutes.
March 24, 2006, 12:54 AM
UserLoser
[quote author=Lord[nK] link=topic=14571.msg149026#msg149026 date=1143161696]
[quote author=Zakath link=topic=14571.msg149017#msg149017 date=1143156053]
I don't monitor response time at all - networks do suffer problems that will delay responses without shutting down the socket.[/quote]

This is true to an extent; however you should still close the socket if no data has been received in over x number of minutes.  IIRC, Battle.net will drop an inactive connection after about 3 minutes.
[/quote]

I don't think they drop inactive connections unless something has changed very recently
March 24, 2006, 6:06 AM
LoRd
[quote author=UserLoser link=topic=14571.msg149032#msg149032 date=1143180375]
[quote author=Lord[nK] link=topic=14571.msg149026#msg149026 date=1143161696]
[quote author=Zakath link=topic=14571.msg149017#msg149017 date=1143156053]
I don't monitor response time at all - networks do suffer problems that will delay responses without shutting down the socket.[/quote]

This is true to an extent; however you should still close the socket if no data has been received in over x number of minutes.  IIRC, Battle.net will drop an inactive connection after about 3 minutes.
[/quote]

I don't think they drop inactive connections unless something has changed very recently
[/quote]

I wasn't referring to the chat activity.
March 24, 2006, 6:19 AM
UserLoser
[quote author=Lord[nK] link=topic=14571.msg149034#msg149034 date=1143181168]
[quote author=UserLoser link=topic=14571.msg149032#msg149032 date=1143180375]
[quote author=Lord[nK] link=topic=14571.msg149026#msg149026 date=1143161696]
[quote author=Zakath link=topic=14571.msg149017#msg149017 date=1143156053]
I don't monitor response time at all - networks do suffer problems that will delay responses without shutting down the socket.[/quote]

This is true to an extent; however you should still close the socket if no data has been received in over x number of minutes.  IIRC, Battle.net will drop an inactive connection after about 3 minutes.
[/quote]

I don't think they drop inactive connections unless something has changed very recently
[/quote]

I wasn't referring to the chat activity.
[/quote]

What are you referring to?  I know during the logon process you can freeze a connection for a long period of time.
March 24, 2006, 6:23 AM
Spilled[DW]
Seeming as I have shitty dsl similiar to yours (dropping all the time), I had this same problem and doing what Lord[nK] said by sending keep alive packets is how I fixed this instead of just sending them back when i recieved them =\

I miss cable :(
March 24, 2006, 6:56 AM
Eternal
[quote author=Spilled link=topic=14571.msg149038#msg149038 date=1143183402]
Seeming as I have shitty dsl similiar to yours (dropping all the time), I had this same problem and doing what Lord[nK] said by sending keep alive packets is how I fixed this instead of just sending them back when i recieved them =\

I miss cable :(
[/quote]

My DSL line used to be very solid and stable. Then the modem died and I was sent a replacement by my ISP (same model, Speedtouch). Now I have the disconnect issue, so it makes me think that something with this modem is causing it, maybe. I'll probably replace it for something more robust and see.
March 24, 2006, 7:28 AM
LoRd
[quote author=UserLoser link=topic=14571.msg149035#msg149035 date=1143181413]
[quote author=Lord[nK] link=topic=14571.msg149034#msg149034 date=1143181168]
[quote author=UserLoser link=topic=14571.msg149032#msg149032 date=1143180375]
[quote author=Lord[nK] link=topic=14571.msg149026#msg149026 date=1143161696]
[quote author=Zakath link=topic=14571.msg149017#msg149017 date=1143156053]
I don't monitor response time at all - networks do suffer problems that will delay responses without shutting down the socket.[/quote]

This is true to an extent; however you should still close the socket if no data has been received in over x number of minutes.  IIRC, Battle.net will drop an inactive connection after about 3 minutes.
[/quote]

I don't think they drop inactive connections unless something has changed very recently
[/quote]

I wasn't referring to the chat activity.
[/quote]

What are you referring to?  I know during the logon process you can freeze a connection for a long period of time.
[/quote]

Yes, providing that you reply to SID_PING and/or send SID_NULL every minute or two.
March 24, 2006, 8:44 AM
Networks
[quote author=Eternal link=topic=14571.msg149040#msg149040 date=1143185334]
[quote author=Spilled link=topic=14571.msg149038#msg149038 date=1143183402]
Seeming as I have shitty dsl similiar to yours (dropping all the time), I had this same problem and doing what Lord[nK] said by sending keep alive packets is how I fixed this instead of just sending them back when i recieved them =\

I miss cable :(
[/quote]

My DSL line used to be very solid and stable. Then the modem died and I was sent a replacement by my ISP (same model, Speedtouch). Now I have the disconnect issue, so it makes me think that something with this modem is causing it, maybe. I'll probably replace it for something more robust and see.
[/quote]

It's obviously not your modem since you stated prior that when a disconnect occurs Stealth Bot functions as it should. It's obvious therefore that it's the bot that you are coding is the problem.
March 24, 2006, 10:22 PM
Kp
[quote author=Networks link=topic=14571.msg149070#msg149070 date=1143238948]
[quote author=Eternal link=topic=14571.msg149040#msg149040 date=1143185334]
[quote author=Spilled link=topic=14571.msg149038#msg149038 date=1143183402]
Seeming as I have shitty dsl similiar to yours (dropping all the time), I had this same problem and doing what Lord[nK] said by sending keep alive packets is how I fixed this instead of just sending them back when i recieved them =\

I miss cable :(
[/quote]

My DSL line used to be very solid and stable. Then the modem died and I was sent a replacement by my ISP (same model, Speedtouch). Now I have the disconnect issue, so it makes me think that something with this modem is causing it, maybe. I'll probably replace it for something more robust and see.
[/quote]

It's obviously not your modem since you stated prior that when a disconnect occurs Stealth Bot functions as it should. It's obvious therefore that it's the bot that you are coding is the problem.
[/quote]

It looks like he meant that he used to have a connection which would stay up for very long periods of time.  After his modem was replaced, the connection became prone to dying -- and severing any open TCP streams in the process.  His remarks are entirely irrelevant to the original problem, which was that the client was not detecting the stream had collapsed.
March 25, 2006, 12:38 AM
Eternal
Well said. That's exactly what I was saying. Looks like the whole DSL line issue has just clouded the picture a bit. So, to confirm, my DSL line is nothing to do with the problem, it was just highlighting the issue that I was not sending keep-alive packets correctly, hence the bot would not autoreconnect when my DSL line disconnected.

Thanks to the suggestions here, I have managed to fix the problem.

;D
March 25, 2006, 8:51 AM

Search