Subject: Sockets in gnu-win32
From: [email-masked] (Fabricio Chalub)

25 Nov 1996 12:01:06 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (Win95; I)
Original-To: [email-masked]
Original-Sender: [email-masked]

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
"[email-masked]" with one line of text: "help".