acl/lib_acl/samples/vstream_popen2/child.c
zsxxsz cf2528eb7c 完善了非阻塞IO的SSL功能;将 samples 移到 lib_acl 目录下
完善了非阻塞IO的SSL功能;将 acl/samples/ 下的示例分别移到 lib_acl 及 lib_protocol 目录下
2014-11-30 21:15:35 +08:00

27 lines
637 B
C

#include "lib_acl.h"
int main(int argc acl_unused, char *argv[] acl_unused)
{
char buf[1024];
int ret, i = 0;
ACL_SAFE_STRNCPY(buf, "first line from child", sizeof(buf));
while (1) {
ret = acl_vstream_fprintf(ACL_VSTREAM_OUT,
">>>send to parent from child(%d)(%s)\n", i, buf);
if (ret == ACL_VSTREAM_EOF) {
printf("(child): write error(%s)\n", acl_last_serror());
break;
}
ret = acl_vstream_gets_nonl(ACL_VSTREAM_IN, buf, sizeof(buf));
if (ret == ACL_VSTREAM_EOF) {
printf("(child): read over(%s)\n", acl_last_serror());
break;
}
if (i++ > 10)
break;
}
return (0);
}