Subject: Re: Network socket application problem
To: None <netbsd-help@netbsd.org>
From: Geoff Wing <mason@primenet.com.au>
List: netbsd-help
Date: 09/27/2002 06:22:40
Joe Magee <jmagee@starrider.com> typed:
: server code (server2.c)=======================
[...]
: int main()
:     struct sockaddr_in server_address;
:     struct sockaddr_in client_address;
: 
: /*  Create an unnamed socket for the server.  */
: 
:     server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
: 
: /*  Name the socket.  */

/* Clear the structs */
memset(&server_address, 0, sizeof(struct sockaddr_in));
memset(&client_address, 0, sizeof(struct sockaddr_in));

:     server_address.sin_family = AF_INET;
:     server_address.sin_addr.s_addr = inet_addr("127.0.0.1");
:     server_address.sin_port = 9734;
                                ^^^^
/* Don't forget htons */
server_address.sin_port = htons(9734);

[...]

Similar stuff for client.c

Regards,
-- 
Geoff Wing : <gcw@pobox.com>
Rxvt Stuff : <gcw@rxvt.org>
Zsh Stuff  : <gcw@zsh.org>