Socket programming

I have a server program I want to add a simple feature to it. It's written in C.

It is like a chat server. People can enter the chat, but I want to make it so that the server allows them to enter or not before they are able to send any text.

There are two types of chatters:

Panelists, who also require approval from the server before entering, but are allowed to chat once they enter.

Audience, who can enter, but can only listen until they are allowed to chat by the server.

I wish I could post the code here, but it is a bit longer than the maximum allows characters here in the post.

I know the addition is a simple few lines, but I am unable to know where to add these lines.

Thanks.
Last edited on
It is not trivial, but not that hard either.

What you want is commonly known as authentication with guest function.

Authentication requires at least two actions:
- Register with storing the data
- Login with comparing against the stored data

So it is required that the data you send to the server consist of multiple parts:

Sending a register command may look like this:
register;user;password

Login command:
login;user;password
login;guest

A client/server communication may look like this:
Client: login;user;password
Server: login;Id
Client: chat;Id;message
I tried to post the code, but it was a bit too long and it did not work.

I do not need the data to be stored. Let's say I have someone online managing the server and he/she allows people to enter or does not. There is no database or files to store the data required.

If I could post all the code, you will know what I am talking about.

Thanks,
Topic archived. No new replies allowed.