Originally Posted by
man inet_pton
AF_INET
src points to a character string containing an IPv4 network address in dotted-decimal format, "ddd.ddd.ddd.ddd", where ddd is a decimal number of up to three digits
in the range 0 to 255. The address is converted to a struct in_addr and copied to dst, which must be sizeof(struct in_addr) (4) bytes (32 bits) long.
The tutorial is wrong. You need to call inet_pton like so:
Code:
inet_pton(AF_INET, "74.125.39.103", &(serveraddr.sin_addr));
Also, Salem was a little mixed up:
Originally Posted by
man connect
RETURN VALUE
If the connection or binding succeeds, zero is returned. On error, -1 is returned, and errno is set appropriately.
You want to send to your socks variable, like so:
Code:
int bytes = send(socks, buffer, sizeof(buffer), 0);
A couple other quick notes:
1. You need a perror after send()
2. Your printf statements need a new line at the end. Change the trailing n to a \n:
Code:
printf("Sende String: %s\n", buffer);