A simple chat room in C.
- macOS, Ubuntu
- Unix Socket
- POSIX Thread Library
make
./server.out
./client.out
A simple chat room in C. Demo: https://youtu.be/3FvHW3uzZA0
License: MIT License
i don't understand how to run this code, can you please help me out?
In the line number 120 and 131, getsockname() and getpeername() are called. I read that it returns address the current address to which the socket is bound. But what exactly are those functions doing there. Help.
Hi,
I have a doubt about the return type here. As far as I understood, the newNode() is to add a new client in the "Client Linked List".
typedef struct ClientNode {
int data;
struct ClientNode* prev;
struct ClientNode* link;
char ip[16];
char name[31];
} ClientList;
ClientList *newNode(int sockfd, char* ip) {
ClientList *np = (ClientList *)malloc( sizeof(ClientList) );
.
.
.
What I am confused about is that the return type of newNode() is a pointer to ClientList
which is actually a variable of struct ClientNode
. Shouldn't the return type be a pointer to data-type rather than an instance of a data-type itself?
Thanks for your time.
How does client is able to know when it has to read and when it has to input message
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.