Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by ams ( 18 years ago )
#include <stdlib.h>
#include <netdb.h>
#include <stdio.h>


struct cfg {
        const char *host;
};

void initd (struct sockaddr_in  * sa, const char *host, u_short port) {

    struct hostent *hptr;
    fprintf(stderr , "host1: %sn", host);

    if (!(hptr = gethostbyname (host))) {
        fprintf(stderr , "cant get host3: %sn", host);
        exit(0);
    }

    fprintf(stderr , "host2: %sn", host);
    exit(0); // debug exit
}

int main(void)
{
        struct sockaddr_in remote[100];
        struct cfg config;
        config.host = "www.google.com";
        initd (remote, config.host, 80);
        return 0;
}

 

Revise this Paste

Your Name: Code Language: