[Tutor] waiting for a particualr string from a socket

G Kiran goki75 at vsnl.net
Sun Aug 17 13:52:12 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






More information about the Tutor mailing list