delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/11/25/12:01:06

From: miguelb AT omega DOT lncc DOT br (Fabricio Chalub)
Subject: Sockets in gnu-win32
25 Nov 1996 12:01:06 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <329A0437.4A1D.cygnus.gnu-win32@omega.lncc.br>
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (Win95; I)
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi!  I fixed my source to make it work using socket and
gnuwin32_socket... I don't know if this is a hack or just an ingenious
(IMHO) use of the C++ language ;)

class wormHole {
   int sock;
   struct hostent *targetAddr;
   struct sockaddr_in target;

   public:
      wormHole (int kind = streamSocket);
      callTarget (char *target_name, int port);
      socket (void) { return sock; }
};

wormHole::wormHole (int kind = streamSocket) {
   printf("[%s socket]\n", kind == SOCK_STREAM ? "stream" : "datagram");
   // old: sock = socket (AF_INET, kind, 0); assert (sock != -1);
   sock = ::socket (AF_INET, kind, 0); assert (sock != -1);
}

See?  Now I call the global socket... if I didn't put the :: operator
the compiler would think that I was using wormHole::socket().

[]s fabricio
-
For help on using this list, 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