Coder Social home page Coder Social logo

rndchat's Introduction

rndchat

A simple Random Chat TCP based program in C

How it works?

A relay server is used to send messages from one to others clients. The server creates a TCP welcome socket, with the port number specified by the user, and another socket for each client that connects to the chat. The maximum number of clients of the chat has to be specified in the code. Each client has a turn to write, and another to read the other's clients messages. Each client can quit the chat sending the message QUIT when is his turn.

Personalizations

  • Max message length: in both client.c and server.c edit the line #define MAXLINE 512 and set your preferred value. (Make sure that both are setted to the same value)
  • Max users per chat: in server.c edit the line #define MAXUSERS 3 and set your preferred value.
  • Color of the messages: in client.c there's a set of predefined colors :
#define ANSI_COLOR_RED     "\x1b[91m"
#define ANSI_COLOR_GREEN   "\x1b[92m"
#define ANSI_COLOR_YELLOW  "\x1b[93m"
#define ANSI_COLOR_BLUE    "\x1b[94m"
#define ANSI_COLOR_MAGENTA "\x1b[95m"
#define ANSI_COLOR_CYAN    "\x1b[96m"
#define ANSI_COLOR_RESET   "\x1b[0m"

Edit the following to suit your prefs:

#define MY_MSG_COLOR 		ANSI_COLOR_BLUE
#define OTHERS_MSG_COLOR	ANSI_COLOR_GREEN

rndchat's People

Contributors

giogiglio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.