Subject: Re: UNIX-Style sockets with gnu-win32
From: [email-masked] (interrupt reQuest)

18 Mar 1997 23:01:07 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <Pine.SUN.3.91.970318091508.14787B-100000@terra> <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.0b2 (Win95; I)
Original-To: [email-masked]
X-Priority: 3 (Normal)
Original-Sender: [email-masked]

  Ron G. Minnich wrote:

    what's the specific problem? i've not had much trouble other than
    the
    select-on-console-and-sockets problem.

    ron

    Ron Minnich                |"I would point them out but ...
    [email-masked]       |  I have no hands." -- Coconut Monkey
    (609)-734-3120             | (see CM at
    www.pcgamer.com/coconut.html)
    ftp://ftp.sarnoff.com/pub/mnfs/www/docs/cluster.html

   Well, what I have done is used a test server i wrote in unix with
  gcc... it works fine in unix, the socket binds, listens and accepts
  connections... i have compiled it with gnuwin32, and proceeded the
  accept, bind etc... with cygwin32_... it compiles, but the socket
  will
  not accept and it is not bound.. here is an attatchment of the code
  i
  used... if you have any simple working code as an example, id
  appreciate
  it, as i need all the help i can get :P

      ---------------------------------------------------------------
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <stdio.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>

  main()
  {

          int server_sockfd, client_sockfd;
          int server_len, client_len;
          struct sockaddr_in server_address;
          struct sockaddr_in client_address;

          server_sockfd = cygwin32_socket(AF_INET, SOCK_STREAM, 0);

          server_address.sin_family = AF_INET;
          server_address.sin_addr.s_addr =
  cygwin32_inet_addr("207.34.139.51");
          server_address.sin_port = 1234;
          server_len = sizeof(server_address);
          cygwin32_bind(server_sockfd, (struct sockaddr
  *)&server_address, server_len);

          cygwin32_listen(server_sockfd, 5);

          printf("Server waiting\n");
          while(1) {
                  char ch;
                  client_sockfd = cygwin32_accept(server_sockfd,
  (struct sockaddr *)&client_address, &client_len);
                  read(client_sockfd, &ch, 1);
                  ch++;
                  write(client_sockfd, &ch, 1);
                  close(client_sockfd);
             }
  }

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".