rendered paste body#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/sysinfo.h>
#include <sys/utsname.h>
#include <signal.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
//#include <fcntl.h>
int main(int argc, char *argv) {
struct hostent *hp;
struct sockaddr_in addr;
int fd;
hp = gethostbyname("www.google.com");
fd = socket(AF_INET, SOCK_STREAM, 0);
addr.sin_port = htons(80);
addr.sin_family = AF_INET;
bcopy((char*)hp->h_addr, (char*)&addr.sin_addr, hp->h_length);
connect(fd, (struct sockaddr *)&addr, sizeof(addr)); // open www.google.com:80
// make request
//char *request;
//sprintf(request, "GET /index.html\nKeep-Alive: 300\nConnection: keep-alive\n\n");
write(fd, "GET /index.html\r\nKeep-Alive: 900\r\nConnection: keep-alive\r\n\r\n", 500);
// receive shit
char buf[1024];
recv(fd, buf, sizeof(buf), 0);
printf(buf);
printf("end\n");
// close(fd);
}