Welcome to the repository for my custom protocol, built on top of TCP/IP. This protocol provides a simple command-based system for real-time communication between clients and servers. It supports basic operations like registering users, joining channels, messaging, and listing users or channels.
- Client Registration: Allows users to register as clients on the server.
- Channel Management: Clients can join or leave communication channels.
- Messaging: Enables sending and receiving messages between users and channels.
- User and Channel Listing: Clients can query the server for active users and channels.
- Server Feedback: Acknowledgement and error handling for all commands.
Command | Issued By | Description |
---|---|---|
REG |
Client | Register as a client. |
JOIN |
Client | Join a specific channel. |
LEAVE |
Client | Leave the current channel. |
CHNS |
Client | List all available channels. |
USRS |
Client | List all users connected to the server. |
OK |
Server | Acknowledge the successful execution of a command. |
ERR |
Server | Indicate an error in the received command. |
MSG |
Both | Send or receive a message to/from a user or channel. |
-
Client Registration (
REG
)
The client starts by sending aREG
command to the server to register itself.REG <handle>
Example:
REG @john
-
Joining a Channel (
JOIN
)
A registered client can join a communication channel using theJOIN
command.JOIN <channel-id>
Example:
JOIN #general
-
Leaving a Channel (
LEAVE
)
Clients can leave the channel they are currently in usingLEAVE
.LEAVE <channel-id>
Example:
LEAVE #general
-
Messaging (
MSG
)
Messages can be sent to a specific user or channel. Messages from the server also arrive using this command.MSG <entity-id> <length>\r\n[payload]
Example:
MSG #general 16\r\nHello everyone!
-
Listing Channels (
CHNS
)
To get a list of all active channels, clients use theCHNS
command.
Example:CHNS
-
Listing Users (
USRS
)
To see a list of connected users, clients issue theUSRS
command.
Example:USRS
-
Acknowledgement and Errors (
OK
andERR
)
The server responds withOK
for successful operations orERR
for errors.
Example:ERR Channel ID must begin with # ERR Username must begin with @