Witem serdecznie,
Chciałem napisać bota irc ponieważ potrzebuje zaimplementować w nim własne funkcjie lecz już na samym początku nie mogę sobie poradzić z połączeniem:

#include <stdio.h>
#include <windows.h>
#include <winsock.h>

int main(int argc, char* argv[])
{
    char nick[] = {"NICK Jimmy7\r\n"};
	char user[] = {"USER Jimmy7 user user :user\r\n"};
	char join[] = {"JOIN #test123\r\n"};
	char *p;
	
	int ret, sock;
	unsigned long ip;
	unsigned short port;
	struct sockaddr_in addr;

	char buf[4096];
	
#ifndef __unix__
	WSADATA wsdat;
	int ws_init = 0;
#endif
	
	ip = inet_addr("213.146.63.33");
	sscanf("6667", "%hu", &port);

#ifndef __unix__
	memset(&wsdat,0,sizeof(wsdat));
	if(WSAStartup(0x0101,&wsdat) != 0) puts("error");
	ws_init = 1;
#endif

	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = ip;
	addr.sin_port = htons(port);
	memset(addr.sin_zero, 0, sizeof(addr.sin_zero));

	sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	ret = connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr));

	send(sock, user, strlen(user), 0);
	send(sock, nick, strlen(nick), 0);
	send(sock, join, strlen(join), 0);

	for(;;) {
		memset(buf, '\0', sizeof(buf));
		recv(sock, buf, sizeof(buf), 0);
		printf("%s", buf);

		p = strstr(buf, "PING");
		if(p != NULL)
		{
			sscanf(p, "PING :%s", nick);
			sprintf(buf, "PONG %s\r\n", nick);
			puts(buf);
			send(sock, nick, strlen(nick), 0);
		}
	}
	return 0;
}

Po uruchomieniu otrzymuje:

:torun.ircnet.pl NOTICE Auth :*** Looking up your hostname...

:torun.ircnet.pl NOTICE Auth :*** Found your hostname (xxx) -- cached

:torun.ircnet.pl NOTICE Auth :*** Looking up your ident...

PING :VDJUKIAFBM

:torun.ircnet.pl 931 Jimmy7 :Jesli nie mozesz dostac sie na PolNet wlacz w kliencie odpowiadanie na zapytanie CTCP VERSION

:torun.ircnet.pl PRIVMSG Jimmy7 :VERSION

:torun.ircnet.pl 451 JOIN :You have not registered

PONG VDJUKIAFBM


:torun.ircnet.pl NOTICE Auth :*** Ident request timed out.

ERROR :Closing link (~Jimmy7@xxx) [Registration timeout]