>>>>> "D" == Dave Thomas <Dave / PragmaticProgrammer.com> writes:

D> I'll play some more tonight. It's nice to know I'm not alone here. My
D> guess is that the cvs diff's will help, as this _used_ to work on this
D> box.

 This is me which is unable to program or there is a problem ?

pigeon% cat a.c
#include <stdlib.h>
#include <sys/types.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int main(int argc, char *argv[])
{
    char            *tpkt = "tclient test message";
    char            *servername;
    struct hostent  *h;
    struct sockaddr_in sa;
    int             soxdes;
    short           portnum;
    int             inlen;
    char            inbuf[1024];
    char buf[1024];
    int alen = sizeof buf;

    memset(inbuf, 0, sizeof inbuf);
    memset(buf, 0, sizeof buf);
    servername = argv[1];
    portnum = atoi(argv[2]);
    h = gethostbyname(servername);
    if (h == NULL) {
        perror("gethostbyname");
        exit(5);
    }
    memcpy((char *)&sa.sin_addr,(char *)h->h_addr, h->h_length);
    sa.sin_family = h->h_addrtype;
    sa.sin_port = htons(portnum);
    soxdes = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (soxdes == -1) {
        perror("socket");
        exit(6);
    }
    if (connect(soxdes, (struct sockaddr *)&sa, sizeof sa) < 0) {
        perror("connect");
        exit(7);
    }
    inlen = recvfrom(soxdes, inbuf, 1024, 0, (struct sockaddr *)buf, &alen);
    if (inlen < 0) {
        perror("recvfrom");
        exit(8);
    }
    printf("received %d family %d\n len %d\n", alen, 
           ((struct sockaddr *)buf)->sa_family, inlen);
    close(soxdes);
}
pigeon% 

pigeon% a.out "localhost" 21
received 1024 family 0
 len 83
pigeon% 

pigeon% uname -nr
pigeon 2.4.14
pigeon% 

condor% a.out "localhost" 21
received 16 family 2
 len 78
condor%
 
condor% uname -nr
condor 2.2.19pre17
condor% 



Guy Decoux