Retrieves a response from the remote host until the pattern sPattern is found. Only the first nMaxData bytes are stored into the buffer sData. If sData is set to NULL, internal buffers are used for retrieval.
WebAPI.bdh
WebTcpipRecvUntil( in hWeb : number, out sData : string allownull, in nMaxData : number, out nReceived : number allownull, in sPattern : string, in nLength : number optional ): boolean;
true if the end of response is found
false otherwise
Parameter | Description |
---|---|
hWeb | Valid handle to a Web connection that was created by WebTcpipConnect |
sData |
Buffer to store the received data. This field also can be set to NULL to use only internal buffers, for example, if data is not to be parsed |
nMaxData |
Maximum amount of bytes to store into sData. Specify STRING_COMPLETE to get all received data. This value has no effect when sData is set to NULL. |
nReceived | Parameter that receives the actual amount of data received from the server |
sPattern |
The termination string. Predefined constants are:
This may also be binary data. For using all available binary data specify STRING_COMPLETE for nLength and use the bin() operator for sData (see example). |
nLength | The length of the binary pattern (optional). Omit this parameter to use all available data. |
dcltrans transaction TWeb var hWeb : number; sHdr : string; sSize : string(20); nReceived : number; sPattern : string; begin WebTcpipConnect(hWeb, "lab3", 80); sHdr := "GET /file5k.html HTTP/1.1\r\n" "Host: lab3\r\n\r\n"; // send HTTP request header WebTcpipSend(hWeb, sHdr); // receive HTTP response header WebTcpipRecvUntil(hWeb, sHdr, STRING_COMPLETE, nReceived, "\r\n\r\n"); SPattern := "\r\n"; WebTcpipRecvUntil(hWeb, sHdr, STRING_COMPLETE, nReceived, "\r\n\r\n"); // receive document StrSearchDelimited(sSize, STRING_COMPLETE, sHdr, "Content-Length: ", 1, "\r\n", 1, STR_SEARCH_FIRST); WebTcpipRecvExact(hWeb, NULL, number(sSize)); // reset the persistent connection WebTcpipShutdown(hWeb, WEB_SHUTDOWN_RESET); end TWeb;
WebTcpipHttp01.bdf, WebTcpipImap401.bdf