Client irc simple !

Description

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

Source / Exemple :


/************************************************************************

  • 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 :


+++

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.