C-chat
Public Attributes | List of all members
Client Class Reference

A type representing a connected client. More...

#include <server.h>

Public Attributes

Socket socket
 
char username [USERNAME_MAX_LENGTH+1]
 
short joined
 
Thread thread
 
struct {
   unsigned int   fileId
 
   long long   fileSize
 
   long long   received
 
   char *   fileContent
 
uploadData [MAX_CONCURRENT_FILE_TRANSFER]
 
struct {
   Thread   downloadThread
 
   unsigned int   downloadedFileId
 
downloadData [MAX_CONCURRENT_FILE_TRANSFER]
 
struct Roomroom
 

Detailed Description

A type representing a connected client.

Member Data Documentation

◆ joined

short Client::joined

A short indicating whether or not, the client joined discussion. Equal to 0 if client isn't in the discussion, else 1.

◆ room

struct Room* Client::room

A pointer to the room the client joined. Can be NULL.

It can be written to NULL by room-owner thread at any time if the room owner disband deletes the room. It can be written to NULL by self thread at any time if the client asks to leave the room. It can be written to non-NULL value ONLY by self thread when the client asks to create a join a room. It can be read by self thread at any time to relay packets to clients in the room.

We MUST acquire clientsLock to access this field.

◆ socket

Socket Client::socket

The socket from server to the client

◆ thread

Thread Client::thread

Thread processing packets sent by user

◆ username

char Client::username[USERNAME_MAX_LENGTH+1]

A buffer meant to contain client username


The documentation for this class was generated from the following file: