This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: UNIX-Style sockets with gnu-win32

  Ron G. Minnich wrote:

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


    Ron Minnich                |"I would point them out but ...       |  I have no hands." -- Coconut Monkey
    (609)-734-3120             | (see CM at

   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
  not accept and it is not bound.. here is an attatchment of the code
  used... if you have any simple working code as an example, id
  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>


          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 =
          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);
                  write(client_sockfd, &ch, 1);

For help on using this list, send a message to
"" with one line of text: "help".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]