ICS InterAction Window question.

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

ICS InterAction Window question.

Postby matematiko » 13 Sep 2010, 05:19

Mr. H.G. Muller

How is the buffer for the ICS Inter Action window set?

Is it a fix value? Or changes as needed? Is it possible to change it at will?

The reason I am asking is because there is a guy in POGO flooding the games with extremely large kibitz messages (this is a POGO server problem that more than likely never will be resolved)....I believe this is causing overflow problems and freezing WinBoard.... I was wondering if the buffer size for the ICS interaction window can be manipulated (increased in this case).

I will try to have WinBoard log file next time.

Regards,
One that does not live to serve, does not deserve to live.
matematiko
 
Posts: 219
Joined: 07 Dec 2008, 17:11
Location: Texas

Re: ICS InterAction Window question.

Postby matematiko » 13 Sep 2010, 06:41

Follow UP

I fixed my problem by telling my ICS emulator to ignore kibitzes with more than 150 characters or if two seconds have not passed since last kibitzed message.

Nevertheless, it will be educational if the overflow condition can be fixed by increasing the buffer size for the InterAction Window, or whatever other suggestion.

Regards,
One that does not live to serve, does not deserve to live.
matematiko
 
Posts: 219
Joined: 07 Dec 2008, 17:11
Location: Texas

Re: ICS InterAction Window question.

Postby H.G.Muller » 13 Sep 2010, 18:07

Are you running WinBoard in a mode where it ignores ICS line breaks?

I guess an ICS is supposed to have a maximum line length, based on the terminal width that you set. WinBoard automatically sends commands to set it properly, based on the ICS window width and the font you use. To truly simulate an ICS, you should break long PVs into continuation lines (starting with "/ ") accordingly.

I have a question about your ICS simulator. How does it work? Is it an executable to which WB connects through a pipe, which then connects to the server through TCP/IP, like timeseal.exe does? I would be interested to create the possibility to connect WinBoard to a Shogi server, using CSA protocol (CSA = Computer Shogi Association), and I wonder what would be the best way to do it. (The alternative is to make a pseudo-engine, which connects. But WB protocol does not have any commands for opponentselection, etc., so you would have to do that through some other channel, like the engine command line, or a console popped up by the pseudo-engine.)
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: ICS InterAction Window question.

Postby matematiko » 13 Sep 2010, 21:02

Mr. H.G.M.

When a message is to be delivered to the ICS InterAction window, this emulator (which is written in Perl) uses a subroutine called iprint:

Code: Select all
{   # make $width and $buffer private to iprint
   my $width=0;
   my $buffer='';
   sub iprint ($;$) {
      my ($mess,$nl)=shift;
      $nl=$nl ? '' : "\\   ";
      foreach (split(//,$mess)) {
         $buffer.=$_;
         $width++;
         if ($_ eq "\n") {
            $width=0;
            # most interfaces expect a \n\r line terminator
            print "$buffer\r";
            $buffer='';
         } elsif ($width==80) {
            $width=length($nl)+length($buffer);
            print "\n\r$nl";
         } elsif ($_ eq ' ') {
            print $buffer;
            $buffer='';
         }
      }
   }
}


Concerning the emulator, its true function is to make WinBoard believe that is connecting to an ICS server, when in reality is connecting to POGO or Yahoo. Of course, WinBoard does not understand Yahoo neither POGO languages so the other function is to act as a middle man and parse commands between Yahoo and Winboard or POGO and Winboard.

If you still think the code for this emulator might be of some help for your project, you can take a look at sourceforge.net and search for YtoICS, there you will find the perl code for the original project called YtoICS, or the "c" code for the young project called yics. Please be aware that neither of these programs work any more because the author abandoned the projects and never implemented a fix for Yahoo CAPTCHA scheme, but never the less, I consider those 50KB of code a real jewel.

The emulator needs to be waiting for WinBoard and not the other way around.

Code: Select all
if (defined($options{'p'})) { #option p is the port number, usually 6000
   $server=int($options{'p'});
   my $lsn=new IO::Socket::INET(
      Proto => 'tcp',
      LocalPort => $server,
      Listen => 1);
   unless (defined $lsn) {
      print "$0: $!\n";
      exit 1;
   }
   print "Waiting for connection on port $server...\n";
   undef $server;
   $server=$lsn->accept;
   $lsn->close;
   unless (defined $server) {
      print "$0: Unable to accept incoming connection: $!\n";
      exit 1;
   }
   printf "Connection accepted from %s.\n",$server->peerhost;
   select $server;
   binmode $server;
   $stdin=$server;
}
elsif ($Config{'osname'} eq 'MSWin32') {
   iprint <<'winerr',1;

Sorry, Y to ICS cannot be run directly when on the Windows platform.  Please have a look at http://ytoics.sourceforge.net/win32.html for details on Windows compatibility issues, and for directions on getting Y to ICS to run on Windows.  (Yes, it is possible, and it's not too complicated either.)

winerr
   exit 1;
} else {
   $stdin=\*STDIN;
   binmode STDOUT;
}
(select)->autoflush(1);


Down the road, the emulator connects to Yahoo

Code: Select all
#$server and $port were previously extracted from an applet
$net=new IO::Socket::INET(Proto => 'tcp', PeerAddr => $server, PeerPort => $port);
unless (defined($net)) {
   iprint "Can't connect!\n";
   exit 1;
}


And to distinguish where the commands are coming from:

Code: Select all
while (1) {
   foreach my $i ($sel->can_read(0.05)) {
      if ($i==$net) { #This is Yahoo commands
         &handleop;
         $net->flush;
      } else { # This is WinBoard commands (both: from ICS Interaction W
         sysread($i,$in,1) or exit;
         if ($in eq "\n") {
            handlecommand $buffer;
            $buffer='';
            $net->flush;
         } elsif ($in ne "\r") {
            $buffer.=$in;
         }
      }
   }
}


Of course this just parts of the program...hope it helps.

PS I forgot:

Code: Select all
my $sel=new IO::Select($stdin,$net);


I guess your best bet is to look at the code for yics which was written in "c"

Regards,
One that does not live to serve, does not deserve to live.
matematiko
 
Posts: 219
Joined: 07 Dec 2008, 17:11
Location: Texas


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 13 guests