Re: [CODE] Socket Problems

From: Jason Wilkins (fenix@IO.COM)
Date: 11/04/98


Opps, you did use htons, but I see other problems...

On Tue, 3 Nov 1998, Jourge Fuzz Bush wrote:

>         dest_addr.sin_family = PF_INET;
>         dest_addr.sin_port = htons(DEST_PORT);
>         dest_addr.sin_addr = *((struct in_addr *)he->h_addr);
> //      bzero(&(dest_addr.sin_zero), 8);
> memset((char *)&dest_addr, 0, sizeof(dest_addr));
>         /*connect socket to remote host*/

You fill in the structure, then you zero it out?

thats like saying

x = FOO;
x = 0;

and then wondering how come x doesn't equal FOO

Here is my code in my library that fills out this structure:

--

_remote_addr.sin_family      = AF_INET;
_remote_addr.sin_port        = htons(port);
_remote_addr.sin_addr.s_addr = address;

--

Hope this helps

--
         The Phoenix - President of The Artistic Intuition Company
    Caelius * Zen-X * Mirror Reflex * Runica * X-Domain * Infinite Realms
                          http://www.io.com/~fenix


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST