Accueil > > > CLIENT IRC SIMPLE !
CLIENT IRC SIMPLE !
Information sur la source
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
+++
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
WIN APIWIN API par omarino_007
Cliquez pour lire la suite par omarino_007
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|