Tintware Documentation : Tint Programming Language : Tint Reference : Ports and Processes : port.matchSyntax#(%port.match,%match) #(%port.match,%match,%notfound) #(%port.match,%match,%notfound,%timeout) #(%port.match,%match,%notfound,%timeout,%lookahead) %port is any port. %match is used to find a match in the characters available from the port. %notfound is what should be returned if a match is not found or the timeout occurs. %timeout is how long to wait in seconds for enough characters to be available. %lookahead is how far Tint should look ahead for characters which match. Using %timeout and %lookahead is necessary to constrain matching, otherwise, Tint will keep looking ahead for a match until memory is exhausted for the port is closed from the other side. Example#(def,p,#(tint.socket)) #(#(p).connect,sourceforge.org,80) #(#(p).put,GET / HTTP/1.1#(tint.byte,10)#(tint.byte,10)) #(#(p).match,#(tint.byte,13)#(tint.byte,10)) HTTP/1.1 400 Bad Request #(#(p).match,#(tint.byte,13)#(tint.byte,10)) Date: Tue, 27 Nov 2001 #(#(p).match,#(tint.byte,13)#(tint.byte,10)) Apache/1.3.19 (Unix) #(#(p).close) |