Subject: [B20.1 Win95] Problem with socket() function call.
From: [email-masked] (Andrew M. Bishop)

17 Jan 1999 06:17:15 -0800
Message-ID: <[email-masked]>
To: [email-masked]

Is there any reason that the socket() function call should return
EINPROGRESS?

I am seeing this happen with the following test program

-------------------- test.c --------------------
#include <stdio.h>

#include <errno.h>
#include <unistd.h>

#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>

#define HOST "g1"
#define PORT 8080

int main()
{
 int serve,client,pid;
 int retval;
 struct sockaddr_in server;
 struct hostent* hp;
 int reuse_addr=1;
 int s;

 serve=socket(PF_INET,SOCK_STREAM,0);
 if(serve==-1)
   {fprintf(stderr,"Cannot create server socket [%d].\n",errno);return(1);}

 setsockopt(serve,SOL_SOCKET,SO_REUSEADDR,&reuse_addr,sizeof(reuse_addr));

 server.sin_family=AF_INET;
 server.sin_addr.s_addr=INADDR_ANY;
 server.sin_port=htons(PORT);

 retval=bind(serve,(struct sockaddr*)&server,sizeof(server));
 if(retval==-1)
   {fprintf(stderr,"Failed to bind server socket [%d].\n",errno);return(1);}

 listen(serve,4);

 client=accept(serve,(struct sockaddr*)0,(int*)0);

 if(client==-1)
   {fprintf(stderr,"Accept on server socket failed [%d].\n",errno);return(1);}

 pid=fork();

 if(pid==0)
   {
    close(serve);

    hp=gethostbyname(HOST);
    if(!hp)
      {fprintf(stderr,"Unknown host '%s' [%d].\n",HOST,h_errno);return(1);}

    memcpy((char*)&server.sin_addr,(char*)hp->h_addr,sizeof(server.sin_addr));

    server.sin_family=AF_INET;
    server.sin_port=htons((unsigned short)PORT);

    s=socket(PF_INET,SOCK_STREAM,0);
    if(s==-1)
      {fprintf(stderr,"Cannot create client socket [%d].\n",errno);return(1);}

    close(s);
    close(client);
   }
 else if(pid>0)
   {
    close(client);
    sleep(30);
    close(serve);
   }

 return(0);
}
-------------------- test.c --------------------

-------------------- test.log --------------------
[main] TEST 1059 (0) winsock_init: res 0
[main] TEST 1059 (0) winsock_init: wVersion 257
[main] TEST 1059 (0) winsock_init: wHighVersion 257
[main] TEST 1059 (0) winsock_init: szDescription Microsoft Windows Sockets Version 1.1.
[main] TEST 1059 (0) winsock_init: szSystemStatus Running on Windows 95.
[main] TEST 1059 (0) winsock_init: iMaxSockets 256
[main] TEST 1059 (0) winsock_init: iMaxUdpDg 65467
[main] TEST 1059 (0) winsock_init: lpVendorInfo 1627485216
[main] TEST 1059 (0) set_process_mask: old mask = FFFFFFFF, new mask = 0
[main] TEST 1059 (0) __release_signal_mutex: released for /home/noer/src/b20/comp-tools/devo/winsup/exceptions.cc:352
[main] TEST 1059 (0) fork: 0 = fork()
[main] TEST 1059 (0) _close: close (3)
[main] TEST 1059 (0) __block_sig_dispatch: waiting for signal_mutex (0xE)
[main] TEST 1059 (0) __release_signal_mutex: released for /home/noer/src/b20/comp-tools/devo/winsup/winsup.h:720
[main] TEST 1059 (0) _close: 0 = close (3)
[main] TEST 1059 (0) cygwin_gethostbyname: h_name g1
[main] TEST 1059 (0) cygwin_socket: socket (2, 1, 0)
[main] TEST 1059 (0) set_winsock_errno: 10036 (WSAEINPROGRESS) -> 119
[main] TEST 1059 (0) cygwin_socket: -1 = socket (2, 1, 0)
[main] TEST 1059 (0) _write: write (2, 0x253F644, 35)
Cannot create client socket [119].

-------------------- test.log --------------------

Also is there likely to be a Beta 20.2 version of the DLL?

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             [email-masked]
                                      http://www.gedanken.demon.co.uk/
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".