delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/15/12:44:26

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: RE: Win95 and sockets
15 Jul 1997 12:44:26 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <01BC9165.966E32A0.cygnus.gnu-win32@sos>
Original-To: "'gnu-win32'" <gnu-win32 AT cygnus DOT com>
Original-Cc: "'Geoffrey Noer'" <noer AT cygnus DOT com>
Encoding: 46 TEXT
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Sergey Okhapkin wrote:
>problem - looks like sockets are non-inheritable on Windows95... Inetd/telnetd works 

The following (MSVC compiled) program prints "closesocket OK" on NT and "closesocket error" on w95.


#include <windows.h>
#include <string.h>
#include <stdio.h>

main(ac,av)
char **av;
{
        SOCKET s;
        static char buf[1024];

        WSADATA WSAData;
        if (WSAStartup(MAKEWORD(1,1), &WSAData)) {
                printf("WSAStartup failed (%d)\n",WSAGetLastError());
                return 255;
        }

        if (ac > 1) {
	             s = atoi (av[1]);
                if (closesocket(s))
                        printf("closesocket error\n");
                else
                        printf("closesocket OK\n");
                exit(0);
        }
        if((s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP))<=0){
                printf("socket error(%d)\n",WSAGetLastError());
                return 0;
        }
        sprintf(buf, "%s %d", av[0], s);
        system(buf);

        WSACleanup();
}



-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia
Looking for a job

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019