From: miguelb@omega.lncc.br (Fabricio Chalub)
Subject: Sockets in gnu-win32
25 Nov 1996 12:01:06 -0800
Sender: daemon@cygnus.com
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <329A0437.4A1D.cygnus.gnu-win32@omega.lncc.br>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (Win95; I)
Original-To: gnu-win32@cygnus.com
Original-Sender: owner-gnu-win32@cygnus.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@cygnus.com" with one line of text: "help".
