Use the new fcntl(), too

This commit is contained in:
goldsimon 2010-02-13 15:56:53 +00:00
parent 8f62d0525c
commit 2027a11331
1 changed files with 5 additions and 3 deletions

View File

@ -66,9 +66,11 @@ sockex_nonblocking_connect(void *arg)
s = lwip_socket(AF_INET, SOCK_STREAM, 0);
LWIP_ASSERT("s >= 0", s >= 0);
/* nonblocking */
opt = 1;
ret = lwip_ioctl(s, FIONBIO, &opt);
LWIP_ASSERT("ret == 0", ret == 0);
opt = lwip_fcntl(s, F_GETFL, 0);
LWIP_ASSERT("ret != -1", ret != -1);
opt |= O_NONBLOCK;
ret = lwip_fcntl(s, F_SETFL, opt);
LWIP_ASSERT("ret != -1", ret != -1);
/* connect */
ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr));
/* should have an error: "inprogress" */