UNIX-Style sockets with gnu-win32
interrupt reQuest
irq@bc1.com
Tue Mar 18 16:07:00 GMT 1997
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 ...
rminnich@sarnoff.com | 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
"gnu-win32-request@cygnus.com" with one line of text: "help".
More information about the Cygwin
mailing list