Jump to content
sMine

[Cerere] Steam - Citeste

Recommended Posts

Elefantul vrea sa mearga in strainatate, soricelul, hop si el . Dar n-are pasaport. Elefantul ii zice:

- Lasa ma ca te bag in buzunar la piept si nu se uita nimeni acolo!

Ajung la granita. Vamesul ii controleaza pasaportul si il intreaba:

-Da in buzunar la piept ce ai?

Elefantul se bate cu pumnul peste buzunar si apoi scoate soricelul.

-Am si eu o poza de cind aram mic!

Link to comment
Share on other sites

Ciudat, mie mi se pare ca apa este uda. Voua nu?

=======================================

Astazi pe DN75 drum foarte aglomerat, in estul Europei ciuma katrina loveste porcii,iarba a inverzit, mama spala rufe, tata taie lemne, ionel merge pe bicicleta, colubm descopera america, cerul e albastru-copacii au inflorit pasarile canta toamna a sosit :)

Link to comment
Share on other sites

OpenSUSE idiot, tot imi da "Connection timed out" cand incerc sa ma conectez la el prin PuTTY -- protocol 2, i-am dat regula in IPTables sa accepte pe 22 ... dar tot nimic :-(

// LE:

CUM MA SA NU AI GCC? FMM!!!

Mai compileaza pulea nmap acum!

// LE(2):

Hm, cred ca e honeypot.

Link to comment
Share on other sites

Mah baieti am o problema GRAVA.....mia dat profu o problema dracoasa...trebuia sa fac UN hello world in C++....am tot incercat DAR....nuj ce sa zic.....

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#define PORT 2020

int main(int argc, char *argv[]) {

//File descriptor lists
fd_set master;
fd_set read_fds;

//server address
struct sockaddr_in serveraddr;
//client address
struct sockaddr_in clientaddr;
//max file descriptor number, listening socket, accepted socket
int fdmax, listener, newfd;
//Buffer for client data
char buf[1024];

int nbytes, addrlen, i, j;
int yes = 1;

//clear the master and temp sets
FD_ZERO(&master);
FD_ZERO(&read_fds);

//create the listener
if((listener = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("<!>Error creating listener!\n");
exit(1);
}

printf("<!>Server-socket() listener successful.\n");

//if address already in use
if(setsockopt(listener, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
perror("<!>Error address already in use!\n");
exit(1);
}
printf("<!>Server-setsockopt() successful.\n");

//bind
serveraddr.sin_family = AF_INET;
serveraddr.sin_addr.s_addr = INADDR_ANY;
serveraddr.sin_port = htons(PORT);
memset(&(serveraddr.sin_zero), '\0', 8);
if(bind(listener, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) == -1) {
perror("<!>Error binding socket!\n");
exit(1);
}
printf("<!>Server-bind() successful.\n");

//listen
if(listen(listener, 10) == -1) {
perror("<!>Server-listen() error!\n");
exit(1);
}
printf("<!>Server-listen() successful, waiting for connections...\n");

//add listener to the master set
FD_SET(listener, &master);

//keep track of the biggest file descriptor
fdmax = listener;

//loop it up
for( {

//copy the master set
read_fds = master;

if(select(fdmax+1, &read_fds, NULL, NULL, NULL) == -1) {
perror("<!>Server-select() error!\n");
exit(1);
}

//loop existing connections looking for data to read
for(i = 0; i <= fdmax; i++) {
//if data available
if(FD_ISSET(i, &read_fds)) {
//handle new connections
if(i == listener) {
addrlen = sizeof(clientaddr);
if((newfd = accept(listener, (struct sockaddr *)&clientaddr, &addrlen)) == -1)
perror("<!>Error accepting new connection!\n");
else {
//add to master set
FD_SET(newfd, &master);
//keep track of the maximum
if(newfd > fdmax)
fdmax = newfd;
printf("<!>New connection from %s on socket %d.\n", inet_ntoa(clientaddr.sin_addr), newfd);
}
}
else {
//if error or connection closed by client
if((nbytes = recv(i, buf, sizeof(buf), 0)) <= 0) {
//connection closed
if(nbytes == 0)
printf("<!>Socket %d was closed by client.\n", i);
else
perror("<!>Receive error!\n");
//close the connection and remove
close(i);
FD_CLR(i, &master);
}
//handle message from a client
else {
//send message to everyone
for(j = 0; j <= fdmax; j++) {
if(FD_ISSET(j, &master)) {
//dont send to the listener or ourselves
if(j != listener && j != i) {
if(send(j, buf, nbytes, 0) == -1)
perror("<!>Error sending message to clients!\n");
}
}
}
}
}
}
}
}
return 0;
}

Cred ca am gresit undeva >_>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...