[Info-vax] invalid buffer size on a connect()?

Steven Schweda sms.antinode at gmail.com
Wed Feb 28 23:28:36 EST 2018


> Here's the section: 

   Great.  A code fragment which can't be compiled or tested. 
My favorite.

   I don't claim any actual IP expertise, but...

[...]
                struct sockaddr_in serv_addr; 
[...]
                serv_addr.sin_family = AF_INET;
                serv_addr.sin_port   = htons( 516 );

   Ok.  You're filling in various members of the serv_addr
(sockaddr_in) structure.

                host = gethostbyname("192.168.1.8");
                (void)memcpy( &serv_addr, host->h_addr,
 sizeof(struct in_addr) );

   And then you put the address into _where_???  The front of
the serv_addr (sockaddr_in) structure, _not_ into
serv_addr.sin_addr (as in that example program)?  At least
one of us is missing something.

   If you're desperate for more IP socket code examples
written by a flounderer:

       http://antinode.info/nte/
       http://antinode.info/orvl/



More information about the Info-vax mailing list