* socket in the windows port
@ 1998-09-10 22:23 Friedman Roy
1998-09-11 16:41 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: Friedman Roy @ 1998-09-10 22:23 UTC (permalink / raw)
To: caml-list
Hi everyone,
In looking at the code of socket.c for windows, I noticed the following
code:
/* Set sockets to synchronous mode */
optionValue = SO_SYNCHRONOUS_NONALERT;
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
(char *)&optionValue, sizeof(optionValue));
Is there a reason it is there? One negative aspect of this is that when
one tries to set a socket to a non blocking mode and then connect to it,
then NT returns a WSAEINVALID error code, meaning that the operation is
not allowed on that socket.
Thanks,
Roy
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: socket in the windows port
1998-09-10 22:23 socket in the windows port Friedman Roy
@ 1998-09-11 16:41 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 1998-09-11 16:41 UTC (permalink / raw)
To: Friedman Roy, caml-list
> In looking at the code of socket.c for windows, I noticed the following
> code:
> /* Set sockets to synchronous mode */
> optionValue = SO_SYNCHRONOUS_NONALERT;
> setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
> (char *)&optionValue, sizeof(optionValue));
> Is there a reason it is there?
I'm not in front of my Windows development machine, so this is all
from memory.
My recollection is that setting the sockets to synchronous mode is
necessary if one wants to read and write from sockets using the
generic ReadFile and WriteFile system calls. This is what the libunix
does, since it does not distinguish file handles and socket handles
(As per the Unix programming model).
> One negative aspect of this is that when
> one tries to set a socket to a non blocking mode and then connect to it,
> then NT returns a WSAEINVALID error code, meaning that the operation is
> not allowed on that socket.
I don't remember how "non-blocking mode" works under Windows. At any
rate, couldn't you just use blocking I/O operations in several threads
instead?
Regards,
- Xavier Leroy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-09-11 17:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-10 22:23 socket in the windows port Friedman Roy
1998-09-11 16:41 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox