begin process at 2012 02 10 07:31:21
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Application

 > CLIENT IRC SIMPLE !

CLIENT IRC SIMPLE !


 Information sur la source

Note :
1 / 10 - par 1 personne
1,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Application Niveau :Expert Date de création :10/02/2003 Date de mise à jour :10/02/2003 22:30:37 Vu / téléchargé :5 360 / 320

Auteur : HotSpot

Ecrire un message privé
Site perso
Commentaire sur cette source (8)
Ajouter un commentaire et/ou une note

 Description

Ce petit prog se connect a voila en tant que user normal....


Source

  • /************************************************************************
  • * Client IRC ---- Main.cpp
  • * Copyright (C) 2002 Elakoui Salim
  • *
  • * This program is free software; you can redistribute it and/or modify
  • * it under the terms of the GNU General Public License as published by
  • * the Free Software Foundation; either version 1, or (at your option)
  • * any later version.
  • *
  • * This program is distributed in the hope that it will be useful,
  • * but WITHOUT ANY WARRANTY; without even the implied warranty of
  • * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • * GNU General Public License for more details.
  • *
  • * You should have received a copy of the GNU General Public License
  • * along with this program; if not, write to the Free Software
  • * Foundation, Inc., 164 Avenue de clichy 75017 Paris 0619238178
  • */
  • //This is the socket library
  • #pragma comment(lib, "ws2_32.lib")
  • #include <winsock2.h>
  • //Normal
  • #include <stdio.h>
  • #include <time.h>
  • #include <istream.h>
  • //Globale Variable
  • SOCKADDR_IN sin_s; //idem l'information pour le serveur
  • int Nick [255];
  • //trans dd[NBR_CONNECTION];
  • //sockets
  • SOCKET sock_s;
  • DWORD WINAPI recv_C (void*);
  • DWORD WINAPI Activity (void *sd);
  • //You can change these information if u want.
  • unsigned long Theard_C;
  • unsigned long Theard_A;
  • int nbr_connection = 0;
  • char *Serveur = "195.101.94.178";
  • int port_serv = 6667;
  • char nick[20];
  • char *user = "USER Super-expert \"\" \"127.0.0.1\" :Noway";
  • //Main function
  • void main ()
  • {
  • printf("\t\t\t\tCONNECTION A VOILA");
  • int fin = 0;
  • printf("\n\nVotre Nick :");
  • cin.getline(nick,20);
  • printf("\n\nConnection à : %s:%d",Serveur);
  • //Initialisaion
  • WSADATA info;
  • WSAStartup(MAKEWORD(2,0), &info);
  • sin_s.sin_addr.s_addr = inet_addr(Serveur);
  • sin_s.sin_family = AF_INET;
  • sin_s.sin_port = htons(port_serv);
  • //Reception des données
  • char b[255];
  • sock_s = socket(AF_INET,SOCK_STREAM,0);
  • printf("\nNumeros du socket : %d",sock_s);
  • int y = connect(sock_s,(SOCKADDR*) &sin_s,sizeof(sin_s));
  • printf("\nConnection : %s:%d (%d)",Serveur,port_serv,y);
  • memset(b,0,255);
  • wsprintf(b,"NICK %s%c",nick,10);
  • send(sock_s,b,255,0);
  • memset(b,0,255);
  • wsprintf(b,"%c%s%c",10,user,10);
  • send(sock_s,b,255,0);
  • CreateThread (NULL,
  • 0,
  • &recv_C,
  • NULL,
  • NULL,
  • &Theard_C);
  • memset(b,0,255);
  • wsprintf(b,"%cJOIN #sirck%c",10,10);
  • printf("\nJoin #sirck",send(sock_s,b,255,0));
  • char h;
  • scanf("%c",&h);
  • }
  • DWORD WINAPI recv_C (void*)
  • {
  • char b[255];
  • printf("\n");
  • while (1)
  • {
  • memset(b,0,255);
  • int y = recv( sock_s,b,255,0);
  • if (y <= 0)
  • {
  • printf("*** Software caused deconnection");
  • exit(0);
  • }
  • b[y] = 0;
  • b[0] = 32;
  • printf("<--(%d):%s",y,b);
  • memset(b,0,255);
  • }
  • return TRUE;
  • }
/************************************************************************
 *   Client IRC ---- Main.cpp
 *   Copyright (C) 2002 Elakoui Salim
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 1, or (at your option)
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 164 Avenue de clichy 75017 Paris 0619238178
 */


//This is the socket library
#pragma comment(lib, "ws2_32.lib")
#include <winsock2.h>

//Normal
#include <stdio.h>
#include <time.h>
#include <istream.h>


//Globale Variable 
SOCKADDR_IN sin_s;	    //idem l'information pour le serveur

int Nick [255]; 
//trans dd[NBR_CONNECTION];

//sockets
SOCKET sock_s;			
DWORD WINAPI  recv_C (void*);
DWORD WINAPI Activity (void *sd);

				   
//You can change these information if u want.
unsigned long Theard_C;
unsigned long Theard_A;
int nbr_connection = 0;

char *Serveur = "195.101.94.178";
int port_serv = 6667;

char nick[20];
char *user = "USER Super-expert \"\" \"127.0.0.1\" :Noway";


//Main function
void main ()
{
	printf("\t\t\t\tCONNECTION A VOILA");
	int fin = 0;

	printf("\n\nVotre Nick :");
	cin.getline(nick,20);
	printf("\n\nConnection à : %s:%d",Serveur);

	//Initialisaion
	WSADATA info;			
	WSAStartup(MAKEWORD(2,0), &info);

	sin_s.sin_addr.s_addr	= inet_addr(Serveur);
	sin_s.sin_family		= AF_INET;
	sin_s.sin_port		= htons(port_serv);
	
	//Reception des données
	
	char b[255];
	sock_s = socket(AF_INET,SOCK_STREAM,0);
	printf("\nNumeros du socket : %d",sock_s);
	int y = connect(sock_s,(SOCKADDR*) &sin_s,sizeof(sin_s));
	printf("\nConnection : %s:%d (%d)",Serveur,port_serv,y);

	
	memset(b,0,255);
	wsprintf(b,"NICK %s%c",nick,10);
	send(sock_s,b,255,0);

	memset(b,0,255);
	wsprintf(b,"%c%s%c",10,user,10);
	send(sock_s,b,255,0);


	CreateThread (NULL,
				0,
				&recv_C,
				NULL,
				NULL,
				&Theard_C);
	
	memset(b,0,255);
	wsprintf(b,"%cJOIN #sirck%c",10,10);
	printf("\nJoin #sirck",send(sock_s,b,255,0));

	char h;
	scanf("%c",&h);
}


DWORD WINAPI  recv_C (void*)
{  	
	char b[255];
	printf("\n");
	while (1)
	{
		memset(b,0,255);
		int y = recv( sock_s,b,255,0);
		if (y <= 0)
		{
			printf("*** Software caused deconnection");
			exit(0);
		}
		b[y] = 0;
		b[0] = 32;

		printf("<--(%d):%s",y,b);
		memset(b,0,255);
	}

	return TRUE;
}

 Conclusion

+++

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

CALCULE DE POLYNOME AVEC ET SANS LA METHODE DE HORNER
Source avec Zip Source .NET (Dotnet) ...UN PETIT ET SIMPLE CRYPTEUR TRÈS UTILE...

 Sources de la même categorie

Source avec Zip Source avec une capture CONTACTS MANAGER par eapaceinfo
Source avec Zip Source avec une capture CONTACTES BOOK par mature
Source avec Zip Source avec une capture [C++/QT] SLIDEALWAYS, RÉALISEZ DES SLIDES POUR VOTRE SITE AV... par doderic
Source avec Zip Source avec une capture MAILLAGE 3D (VTK + QT) par ammoun007
Source avec Zip Source avec une capture CONVHTML : UN UTILITAIRE DE CONVERSION POUR FICHIERS HTML par pgl10

Commentaires et avis

Commentaire de HotSpot le 10/02/2003 23:12:18

C un truc simple mais modifiable !! remarque pas d'indentification par IDENT

Commentaire de BlackGoddess le 20/02/2003 11:05:34

ah ? il me semblait que apres l'envooi du NICK il fallait attendre le premier PING du serveur pour lui repondre par PONG, USER, etc

Commentaire de HotSpot le 20/02/2003 16:35:57

c vrai .... merci de ùe le préciser ... :) je mettrais provhanement un serveru IRC

Commentaire de Melnofil le 05/11/2003 04:48:15

Heuu... ('
' == 10) tu devais éditer ta source en remplacant les %c en conséquence :p

Commentaire de Melnofil le 05/11/2003 04:50:49

A tiens, ca s'affiche pas chez moi, bon les '' du msg juste au-dessus contenaient un antislash n (un retour à la ligne koi ^^)

Commentaire de SfyLer le 05/05/2004 23:21:29

faudrai que tu répond au ping du serveur que ton client reste connecté

Commentaire de BlackGoddess le 06/05/2004 11:28:39

"je mettrais provhanement un serveru IRC "
&gt;&gt; c'est pas une maince affaire ca ...

Commentaire de ghostahjay le 14/11/2004 21:16:01

Impossible de compiler, mon editeur compile en boucle et me trouve plein d'erreur, mon compilateur est GCC, editeur DevCPP. QQun peut m'aider ? Je suis entierement debutant :D

PS: HotSpot tu t pris pr un mannequin sur ta photo ? :)

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 2,418 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales