Re: socket in the windows port

From: Xavier Leroy (
Date: Fri Sep 11 1998 - 18:41:05 MET DST

Date: Fri, 11 Sep 1998 18:41:05 +0200
From: Xavier Leroy <>
To: Friedman Roy <>,
Subject: Re: socket in the windows port
In-Reply-To: <Pine.GSO.3.95-heb-2.07.980911002002.20311A-100000@csa>; from Friedman Roy on Fri, Sep 11, 1998 at 12:23:29AM +0200

> In looking at the code of socket.c for windows, I noticed the following
> code:
> /* Set sockets to synchronous mode */
> (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


- Xavier Leroy

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:15 MET