[Tutor] look for a particular string in a stream

G Kiran goki75 at vsnl.net
Fri Aug 15 21:34:23 EDT 2003


I am reading from a socket and need to wait till a particular string arrives

s=socket(AF_INET,SOCK_STREAM)
s.listen(5)
conn,recv=s.connect()
  while (1):
        waitonsocket(conn,"START")
        blah
        blah
        blah


presently i implemented a string queue of length of string i am waiting for
and i repeatedly read one byte/char at time from the socket and add it to
the queue
and check whether queue contains the string i am looking for...is there a
faster way of doing this

reading one char at a time and adding and checking the queue slows down the
program

--kiran


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003




More information about the Tutor mailing list