collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Bot not reconnecting when disconnected.  (Read 2018 times)

0 Members and 1 Guest are viewing this topic.

Offline Dice

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Bot not reconnecting when disconnected.
« on: April 26, 2006, 05:48:08 pm »
I set up a v0.2.3 BeBot for my org as a raidbot on a win98 machine in my basement that also hosts the orgs IGN guildbot.

The BeBot runs perfeclty and does its job, but everytime it is disconnected from the chatserver its not reconnecting itself. I tried to figure it out for some time now, but cannot seem to find a solution.
The bot didn't crash, it was just disconnected. IGN just reconnects... and BeBot stays offline.

When I walk down to the bot machine and look at the console, it's spamming:

Warning: socket_select(): unable to select [317]:  in C:\Bebot\AOChat.php on line 234

Warning: socket_select(): supplied argument is not a valid Socket resource in C:\Bebot\AOChat.php on line 234

in a endless loop. I have to CTRL-C out of it and manually restart it. Then it works fine again.

main.php
Code: [Select]
while(true)
{
if ($aoc -> wait_for_packet() == "disconnected")
$bot -> reconnect();

$bot -> cron();
}

I'm not sure, but I think this might be where the problem is hidden... Line 234 in AOChat.php is inside the wait_for_packet() function.

I use AOChat.php $Id: AOChat.php,v 1.19 2005/11/29 23:22:46 os Exp $

Any idea what is causing this? Since noone else posted about this problem (or at least I didn't find anything about it) I guess it's a problem unique to my setup... help please.

Offline Dice

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Bot not reconnecting when disconnected.
« Reply #1 on: April 28, 2006, 03:06:43 am »
It just happened again. This time I was online with the game client too. I got the login greeting message you get when you log into the game, a moment later IGN send me the news again, like it does when you log on... and the raidbot went offline and stayed offline.

It was spamming the exact same warnings again.

I love the BeBot as a raidbot, because it's not bloated with useless features like IGN... but when I cannot make it available for the org 24/7 it's rendered virtually useless. :(

I'm wondering now if it's possible to setup PHP in a way that it stops executing the current script when a warning is issued? When the bot would "crash" instead of doing this warning message loop I could make it restart automagically.
Of course that wouldn't be a perfect solution, if a raid would be in progress everybody would have to rejoin the bot... but it's better than the bot being unavailable for hours... any ideas? Please?

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Bot not reconnecting when disconnected.
« Reply #2 on: April 28, 2006, 12:55:27 pm »
I hope your not using AOChat.php 1.19 with Bebot 0.2.3 That version of the bot wasn't written to support the newest AOChat. For 1.19 of AOChat you'd want at least a 0.3.2 or higher version.

BTW, that error your getting is what happens when the Bot looses contact with the Internet. Also AOChat will never get a 'disconnected' packet if it can't see the chat server. Keep in mind Bebot is still in a Beta stage and event handlers for some things have yet to be written ... like what to do when it gets disconnected from the Net.

I've had that same error occur a few times that you report here. Each and everytime is was because my DSL router reset and wouldn't re-connect to the far end router without manually resetting my DSL router. Only had a chat server disconnect once and true to form the bot reconnected. Thats just my case however. Your case... could be anything that interupts the net connection to the machine long enough to time the bots connection out. As stated there's no code in the bot to handle a net connection drop like that so it spams the error from AOC. IGN on the other hand has error handling that will keep retrying to connect after a given amount of time. Maybe Khalem or one of the others around here that work on Bebot(inlc myself) will look into that for the next version (0.4.x series).

Oh and one last thing. Win98??? Are you crazy? Thats not even a server environment. I highly recommend at least WinNT 4.0 if you can still get a copy. I use Win2K myself. Or you could go with one of the many Linux flavors out there. I wouldn't be surprised if it's the TCP/IP Stack buffers overflowing in Win98 that keep resetting and killing the bot on you.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Dice

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Bot not reconnecting when disconnected.
« Reply #3 on: April 28, 2006, 09:36:12 pm »
Aaaah. That explains alot. So it's just not implemented ie working as intended ;D In that case I'll have to write my own handler to deal with a connection timeout. Thanks a ton.

Offline Dice

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Bot not reconnecting when disconnected.
« Reply #4 on: May 03, 2006, 10:49:53 pm »
For now I just changed the main loop in main.php to
Code: [Select]
while(true)
{
$result = $aoc -> wait_for_packet();

if (($result == "disconnected") || ($result === false))
$bot -> reconnect();

$bot -> cron();
}
This will prevent the endless warning message loop and just make the bot reconnect by shuting down and then being restarted by start.php.
Not the best fix, but makes sure the bot is always available.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 507
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal