LAN Transmission Protocol Version 1.0 — November 2025 Author: Bashar Mohammad Wakil (24BCE1964)
LANTP (LAN Transmission Protocol) is a simple, text-based application-layer protocol designed for LAN-based chat and command transmission over TCP sockets. It defines a human-readable packet structure to standardize how clients and servers exchange messages, commands, and control information.
This protocol powers the LANTP Chat Server system — enabling secure authentication, structured commands, and reliable communication between multiple users.
- 💬 Readable — easily debuggable in plaintext form
- ⚙️ Structured — consistent message format across systems
- 🔄 Synchronous — works over persistent TCP connections
- 🧩 Extensible — new
TYPEs can be added in future versions
Every message (client or server) follows this format:
LANTP/1.0
TYPE: <MessageType>
FROM: <Sender>
[TO: <Receiver>]
CONTENT: <Payload>
<END>
Each field is separated by a newline (\n), and the literal <END> line marks the end of the packet.
| Field | Required | Description |
|---|---|---|
| TYPE | ✅ | Defines the purpose of the packet (e.g., MSG, SYS, AUTH_OK) |
| FROM | ✅ | Sender identifier (SERVER, CLIENT, or username) |
| TO | ❌ | Optional recipient (for private messages) |
| CONTENT | ✅ | Main message body (text content or command) |
All packets must begin with LANTP/1.0 and end with <END>.
Client → Server
LANTP/1.0
TYPE: SYS
FROM: CLIENT
CONTENT: LOGIN test1 password
<END>
Server → Client
LANTP/1.0
TYPE: AUTH_OK
FROM: SERVER
CONTENT: ✅ Logged in as test1. You can now chat.
<END>
Client → Server
LANTP/1.0
TYPE: MSG
FROM: test1
CONTENT: Hello everyone!
<END>
Server → All Clients
LANTP/1.0
TYPE: MSG
FROM: test1
CONTENT: test1: Hello everyone!
<END>
LANTP/1.0
TYPE: MSG
FROM: test1
TO: user2
CONTENT: [PM] test1: Hey, you there?
<END>
Server → Client
LANTP/1.0
TYPE: PING
FROM: SERVER
CONTENT:
<END>
Client → Server
LANTP/1.0
TYPE: PONG
FROM: CLIENT
CONTENT:
<END>
LANTP/1.0
TYPE: SYS
FROM: SERVER
CONTENT: 📢 test1 joined the chat.
<END>
LANTP/1.0
TYPE: SYS
FROM: SERVER
CONTENT: [Server Announcement] Maintenance at 6 PM.
<END>
| TYPE | Direction | Description |
|---|---|---|
SYS |
Server → Client | System messages, announcements, status updates |
MSG |
Both | Chat messages (global or private) |
AUTH_OK |
Server → Client | Successful authentication |
AUTH_FAIL |
Server → Client | Failed authentication |
CMD_RESP |
Server → Client | Response to a command (/help, /users, etc.) |
PING |
Server → Client | Heartbeat check |
PONG |
Client → Server | Heartbeat reply |
ERR |
Server → Client | Malformed or unauthorized packet |
| Command | Description |
|---|---|
/help |
Display available commands |
/users |
List online users |
@username <msg> |
Send private message |
exit |
Disconnect gracefully |
| Command | Description |
|---|---|
/kick <user> [reason] |
Kick and temporarily ban a user |
/mute <user> [minutes] |
Mute user temporarily |
/unmute <user> |
Unmute a muted user |
/unban <user> |
Remove a ban |
/whois <user> |
Show IP, role, connection time |
/announce <msg> |
Send broadcast announcement |
- Client connects to server via TCP socket.
- Server greets client with a
SYSmessage. - Client sends
SIGNUPorLOGINcommand.
- If successful →
AUTH_OKsent. - If failed →
AUTH_FAILsent.
- Authenticated clients may send
/commands,MSG, or@username. - Server relays or responds with appropriate
TYPE.
- Server sends
PINGevery 30 seconds. - Client must reply
PONG. - No
PONGwithin 180 seconds ⇒ disconnection and log entry.
- Client sends
exitor disconnects manually. - Server logs disconnect, removes from active list.
Malformed or incomplete packets are ignored or responded to with:
LANTP/1.0
TYPE: ERR
FROM: SERVER
CONTENT: Malformed or incomplete packet.
<END>
Servers should not crash or hang on bad packets.
The server logs:
- User logins/logouts
- Admin actions (kick/mute/unmute/unban)
- Timeouts and errors
- Private message traces (sender/receiver only)
Logs are stored in:
server/logs/YYYY-MM-DD.log
-
Use per-client threads for simultaneous connections.
-
Wrap file writes in a global lock for thread safety.
-
Track:
active_usersmuted_usersbanned_usersconnected_sincelast_pong
- Maintain a receive thread to parse
<END>delimited messages. - Always respond to
PINGwithPONG. - Respect
/exitand socket closures gracefully.
| Version | Date | Summary |
|---|---|---|
| 1.0 | Nov 2025 | Initial release — stable LAN chat protocol |
| 1.1 (planned) | 2026 | Add binary framing, optional checksums, session resume |
Client Server
| |
| ------ CONNECT ------------>|
| |
| LOGIN alex pass ----------->|
| |
| <--- AUTH_OK ---------------|
| |
| MSG "hello" --------------->|
| <--- MSG "hi" --------------|
| |
| <--- PING ------------------|
| PONG ---------------------->|
| |
| exit ---------------------->|
| <--- SYS "bye" -------------|
This protocol was developed by Bashar Mohammad Wakil (24BCE1964) as part of a Computer Networks (CN) project at VIT.
Use, modification, and redistribution are permitted with attribution.
- LANTP is intentionally simple and easy to implement in any language (Python, C, Java, etc.).
- The design borrows from early text-based protocols like SMTP, POP3, and IRC.
- It serves both as an educational tool and a functional chat system foundation.
✅ End of LANTP/1.0 Specification