<DIV> Dear Friends and Tutors,</DIV>
<DIV> Thanx for all your previous answers I have a new problem</DIV>
<DIV> I am writing a python script which will connect to Internet Chess Club via telnet(the IP of the server is '65.245.208.34' and the port I want is 5056)</DIV>
<DIV> Connecting works fine :</DIV>
<DIV> "import telnetlib</DIV>
<DIV> telnetlib.Telnet(host='65.245.208.34',port='5056')"</DIV>
<DIV>Now the server asks for username and password...</DIV>
<DIV>I want the programme to login as guest so :</DIV>
<DIV> "a=telnetlib.Telnet(host='65.245.208.34',port='5056')</DIV>
<DIV> a.read_until('login:')</DIV>
<DIV> a.write('guest \n')"</DIV>
<DIV> Now programme is connected to the server.Now I want to type commands and such things...Before I write a command I should do</DIV>
<DIV> "a.read_until('aics%')"</DIV>
<DIV> to get the command line.</DIV>
<DIV>But the problem starts here.Some announces and chats come from the server and the server seems like that</DIV>
<DIV> "xxx shouts: hi all</DIV>
<DIV>aics%</DIV>
<DIV>bbb shouts:hi again</DIV>
<DIV>aics%_"</DIV>
<DIV>The real command line is the second "aics%" but the programme types "a.read_until('aics%') only once so that when I type in a command programme doesn't send the command to the server.</DIV>
<DIV>So I should make the programme type "a.read_until('aics%')" every 5 seconds or so...</DIV>
<DIV>Can anyone show me how and where to do this change?</DIV>
<DIV>Below is the script :</DIV>
<DIV>"def icc():<BR> a=telnetlib.Telnet(host='65.245.208.34',port='5056')<BR> print str(a.read_until('login:'))<BR> a.write('guest')<BR> a.write('\n')<BR> a.read_until('aics%')<BR> a.write('-ch 1\n')<BR> a.read_until('aics%')<BR> a.write('-ch 165\n')<BR> a.read_until('aics%')<BR> a.write('set shout 0\n')<BR> a.read_until('aics%')<BR> a.write('set sshout 0\n')<BR> a.read_until('aics%')<BR> print
str(a.read_until('aics%')) <BR> for x in range(500000):<BR> d=raw_input(Command :>')<BR> a.write(str(d))<BR> a.write('\n')<BR> print str(a.read_until('aics%'))</DIV>
<DIV>Regards,</DIV>
<DIV>Ali Polatel</DIV>
<DIV> </DIV>
<DIV> </DIV><p>
                <hr size=1>Do you Yahoo!?<br>
Yahoo! Mail is new and improved - <a href="http://us.rd.yahoo.com/mail_us/taglines/new/*http://promotions.yahoo.com/new_mail">Check it out!</a>