Hi Group,
for porting issues, I need to translate a fcntl(). In the original
*nix-code the following is used:
fcntl(sd, F_SETFL, O_NONBLOCK);
to make sd a non blocking socket. Now I was wondering if
// If iMode = 0, blocking is enabled;
// If iMode != 0, non-blocking mode is enabled.
int iMode = 1;
ioctlsocket(sd, FIONBIO, (u_long FAR*) &iMode)
contains the same behaviour for win32 systems.
Many kind greetings,
--wim
|
|
0
|
|
|
|
Reply
|
wim
|
7/26/2004 10:15:47 PM |
|
Wim Deprez wrote:
> Hi Group,
>
> for porting issues, I need to translate a fcntl(). In the original
> *nix-code the following is used:
>
> fcntl(sd, F_SETFL, O_NONBLOCK);
>
> to make sd a non blocking socket. Now I was wondering if
>
> // If iMode = 0, blocking is enabled;
> // If iMode != 0, non-blocking mode is enabled.
> int iMode = 1;
> ioctlsocket(sd, FIONBIO, (u_long FAR*) &iMode)
>
> contains the same behaviour for win32 systems.
You'd better ask in Winsock programming group, like
alt.winsock.programming.
However, it is easy to test: just open a connection
to a remote host and execute the following:
int r;
char buf;
r1 = read(fd, &buf, 1);
assert(r1 == -1 && errno == EAGAIN);
or something similar.
(make sure the remote host does not send anything.
www.com:80 will do).
--
Lev Walkin
vlm@lionet.info
|
|
0
|
|
|
|
Reply
|
Lev
|
7/27/2004 5:24:12 AM
|
|
Wim Deprez wrote:
> for porting issues, I need to translate a fcntl(). In the original
> *nix-code the following is used:
>
> fcntl(sd, F_SETFL, O_NONBLOCK);
>
> to make sd a non blocking socket. Now I was wondering if
If you only want to switch from blocking to non-blocking mode, you should
first get the current flags, add O_NONBLOCK and then set these flags.
The above code would clear the current flags set.
Regards,
Daniel
|
|
0
|
|
|
|
Reply
|
Daniel
|
7/27/2004 9:28:26 AM
|
|
|
2 Replies
959 Views
(page loaded in 0.072 seconds)
Similiar Articles: fcntl() - ioctlsocket() - comp.unix.programmerHi Group, for porting issues, I need to translate a fcntl(). In the original *nix-code the following is used: fcntl(sd, F_SETFL, O_NONBLOCK); to... fcntl() - ioctlsocket() - Mombu the Microsoft Forumfcntl() - ioctlsocket() ALT Winsock Programming ... Hi Group, for porting issues, I need to translate a fcntl(). In the original fcntl() - ioctlsocket() - comp.unix.programmer | Computer GroupHi Group, for porting issues, I need to translate a fcntl(). In the original *nix-code the following is used: fcntl(sd, F_SETFL, O_NONBLOCK); to... 7/20/2012 5:29:48 PM
|