mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-05 05:18:53 +08:00
cf2528eb7c
完善了非阻塞IO的SSL功能;将 acl/samples/ 下的示例分别移到 lib_acl 及 lib_protocol 目录下
25 lines
506 B
C
25 lines
506 B
C
#include "lib_acl.h"
|
|
|
|
int main(void)
|
|
{
|
|
ACL_VSTRING *buf = acl_vstring_alloc(100);
|
|
const char *s = "hello world\r\nhello world1\nhello world2\r\nhello world3";
|
|
const char *p = s, *p1;
|
|
ssize_t n = (ssize_t) strlen(p);
|
|
|
|
while (n > 0) {
|
|
ACL_VSTRING_RESET(buf);
|
|
p1 = p;
|
|
if (acl_buffer_gets_nonl(buf, &p, (size_t) n) == NULL
|
|
&& ACL_VSTRING_LEN(buf) == 0)
|
|
{
|
|
break;
|
|
}
|
|
printf(">>%s\n", acl_vstring_str(buf));
|
|
n -= p - p1;
|
|
}
|
|
|
|
acl_vstring_free(buf);
|
|
return (0);
|
|
}
|