All pastes #517296 Raw Edit

Someone

public text v1 · immutable
#517296 ·published 2007-05-29 00:37 UTC
rendered paste body
//-----------------------Includes
#include <winsock.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <iostream>
//-----------------------

#define DEST_IP "206.41.117.251"
#define DEST_PORT 6667

//-----------------------MISC
#pragma comment(lib, "wsock32")
using namespace std;
//-----------------------

int main()
{
	int sockfd;
		struct sockaddr_in dest_addr; // will hold the destination addr
		sockfd = socket(PF_INET, SOCK_STREAM, 0); // do some error checking!

		dest_addr.sin_family = AF_INET; // host byte order
		dest_addr.sin_port = htons(DEST_PORT); // short, network byte order
		dest_addr.sin_addr.s_addr = inet_addr(DEST_IP);
		memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);

		// don't forget to error check the connect()!
		if(connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)))
		{
			cout << "win" << endl;
		}
		else
		{
			cout << "lose" << endl;
		}
		
		
	cin.get();
}