All pastes #164782 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-09-08 23:54 UTC
rendered paste body
BOTINFO biMini = {
		0, //socket, gets defined later
		"irc.wikkedwire.com", //server to connect to
		"#CPP", //channel to join
		"CppBot", //nick to use
		new char[513],
		new char[513],
		6667, //port
		"MiniBOT Version 1.8 End Message Detection - Op Security", //entry message
		"miniman@wikkedwire-D7F73BF0.dhcp.mdsn.wi.charter.com" //hostname of bot op
	};
	
	WSADATA wsaData;
	WSAStartup(MAKEWORD(2, 0), &wsaData);
	biMini.BotSock = socket(AF_INET, SOCK_STREAM, 0);
	if(biMini.BotSock == INVALID_SOCKET){
		Report("Failed to create Socket!");
		WSACleanup();
		return FALSE;
	}

	SOCKADDR_IN SockInfo;
	PHOSTENT pheServer = gethostbyname(biMini.szServer);
	SockInfo.sin_addr = *(struct in_addr *)pheServer->h_addr_list[0];
	SockInfo.sin_family = AF_INET;
	SockInfo.sin_port = htons(biMini.nPort);

	int nResult = connect(biMini.BotSock, (SOCKADDR*)&SockInfo, sizeof(SockInfo));
	if(nResult == SOCKET_ERROR){
		Report("Failed to connect to server!");
		WSACleanup();
		return FALSE;
	}
	CreateThread(0, NULL, (LPTHREAD_START_ROUTINE)&Recieve, &biMini, NULL, NULL);
	CreateThread(0, NULL, (LPTHREAD_START_ROUTINE)&KeepAlive, &biMini, NULL, NULL);