Subject: Re: Network socket application problem
To: Jeremy C. Reed <gcw@pobox.com>
From: Joe Magee <jmagee@starrider.com>
List: netbsd-help
Date: 09/27/2002 01:40:02
Thanks Geoff and Jeremy for writing.
Geoff: The htons() had no effect. I suspected it wouldn't since this code
compiles and runs on a linux/i386 system.
Jeremy: Clearing the buffers was the key. After adding the memset() lines,
the client/server work now.
Thank you for your suggestions.
Joe Magee
----- Original Message -----
From: "Jeremy C. Reed" <reed@reedmedia.net>
To: "Joe Magee" <jmagee@starrider.com>
Sent: Friday, September 27, 2002 1:27 AM
Subject: Re: Network socket application problem
> The memset to clear the server_address is the key. If not, I was getting
> "Can't assign requested address".
>
> And you may also want to do something like:
>
> if (bind(server_sockfd, (struct sockaddr *)&server_address,
server_len)) {
> warn("Couldn't bind to socket");
> exit(1);
> }
>
> (be sure to include err.h and errno.h)
>
> Jeremy C. Reed
> http://www.reedmedia.net/
>
>