Demo entry 5862457

Socket

   

Submitted by anonymous on Aug 04, 2016 at 21:43
Language: C. Code size: 1.2 kB.

#include <stdlib.h>
#include <stdio.h>
#define _XOPEN_SOURCE
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
// #include <sys/un.h>         // Per testare in locale
#include <fcntl.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <pthread.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <crypt.h>
#include <arpa/inet.h>
#define N_THREADS 200
#define SHORT_SIZE 256
#define MEDIUM_SIZE 512
#define LONG_SIZE 1024
#define FILE_PERM 0644
#define SIZE 13
#define N 10
#define M 10

typedef struct user {
    char nickname[SIZE];
    char password[SIZE];
    struct user* nextUser;
} User;
typedef User * userPtr;

typedef struct logged_user {
    int id_client;
    char nickname[SIZE];
    char ip_address[MEDIUM_SIZE];
    int posx;
    int posy;
    time_t login_time;
    pthread_t userTid;
    struct logged_user* nextLogUser;
} Logged_user;
typedef Logged_user* logUserPtr;

typedef struct turnList {
    int id_client;
    struct turnList* nextTurn;
} TurnList;
typedef TurnList* turnListPtr;

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).