#include #include #include #include #include #include #include #define DEST_IP "66.252.19.80" #define DEST_PORT 6667 int main() { printf("ok"); int sockfd; struct sockaddr_in dest_addr; printf("ok"); sockfd = socket(AF_INET, SOCK_STREAM, 0); printf("ok"); dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(DEST_PORT); dest_addr.sin_addr.s_addr = inet_addr(DEST_IP); printf("ok"); memset(&(dest_addr.sin_zero), '\0', 8); printf("välikatsastus"); if (connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) < 0) printf("Epäonnistunut yhteydenotto"); else printf("Onnistunut yhteys!"); int bufsize = 1024; char buffer[bufsize]; char *msg = "USER Botti localhost localhost :Botti\r\n"; send(sockfd, msg, 1024, 0); msg = "NICK Botti\r\n"; send(sockfd, msg, 1024, 0); msg = "JOIN #tesaus\r\n"; send(sockfd, msg, 1024, 0); while(1) recv(sockfd, buffer, 1024, 0); }