All pastes #397627 Raw Edit

Unnamed

public c v1 · immutable
·published 2007-03-16 16:57 UTC
rendered paste body
#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <unistd.h>#include <stdio.h>#define DEST_IP "66.252.19.80"#define DEST_PORT 6667int 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);}