以下のようにCGI関数にて複数回のレスポンスでコンテンツを返却します。
コード: 全て選択
/* 100回のレスポンスでコンテンツを返却する例 */
#define REPEAT 100
void cgi_func(T_HTTP_SERVER *http)
{
int i;
char contents[] = "Divide Contents Test <p>";
HttpSetContent(http, 0);
HttpSetContent(http, "HTTP/1.1 200 OK\r\n");
HttpSetContent(http, "Content-Type: text/html\r\n");
HttpSetContentLen(http, "Content-Length: ", (sizeof(contents)-1)*REPEAT);
HttpSetContent(http, "\r\n");
HttpSendContent(http, NULL, 0); /* レスポンスヘッダのみ送信 */
i = 0;
while (i < REPEAT) {
HttpSetContent(http, 0);
HttpSetContent(http, contents); /* 部分的なコンテンツを送信 */
HttpSendContent(http, NULL, 0);
i++;
}
}