wolfssl-examples
wolfssl-examples copied to clipboard
fixing select usage
-
Set timeout in tcp_select timeout.tv_sec = to_sec;
-
Set non-blocking to "connd", as well. fcntl(connd, F_SETFL, O_NONBLOCK)
-
tcp_select(connd,...) for wolfSSL_accept, read, write
-
make all 3 args non-NULL for select. NULL arg derives error on MacOS.
====
Totally changed to a single polling point.
SV_CTX *sv_poll() {
poll();
return next_ctx;
}
int main() {
while(1) {
switch (sv_main(sv_ctx = sv_poll())) {
case NB_CONTINUE:
break;
}
}