#include #include #include #include #include int main(int argc, char** argv) { // 1. Create the socket int sock; if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { printf("Could not create socket for connection to server."); return 0; } // 2. Set the server address struct sockaddr_in srv_addr; memset(&srv_addr, 0, sizeof(struct sockaddr_in)); srv_addr.sin_family = AF_INET; srv_addr.sin_addr.s_addr = inet_addr("__.___.___.___"); srv_addr.sin_port = htons(___); // 3. Connect to the server and run the loop. if (connect(sock, (struct sockaddr*)&srv_addr, sizeof(struct sockaddr_in)) < 0) { printf("Could not connect to server."); return 0; } // 4. Send something send(sock, ____, ___, 0); // 5. receive the response and print out as a string char buf[128]; int len = recv(sock, buf, 127, 0); buf[len] = '\0'; printf("%s", buf); // 6. Clean up close(sock); return 0; }