PyRelay is a complete IRC-style client/server written using only Python’s standard library. It supports:
Multiple simultaneous clients
NICK and USER
JOIN, PART, LIST, NAMES
PRIVMSG and NOTICE
PING/PONG
QUIT
IRC numeric replies
Friendly client commands such as /join, /msg, and /nick
It supports multiple simultaneous users, public channels, private messages, nicknames, channel listings, and common IRC commands.
- Multi-client TCP chat server
- Terminal-based IRC client
- Public chat channels
- Private messages
- Nickname registration
- Join and leave notifications
- User lists
- Channel lists
PING/PONGsupport- Basic IRC numeric replies
- No external Python dependencies
- Python 3.8 or newer
PyRelay uses only Python’s standard library, so no package installation is required.
Clone the repository:
git clone https://github.com/ethanpmiller/pyrelay.git cd pyrelay
Starting the Server
Start the server on the default port, 6667: bash
python pyrelay.py server
The server listens on all network interfaces by default.
To use a different port: bash
python pyrelay.py server --port 7000
To bind the server to a specific address: bash
python pyrelay.py server --host 127.0.0.1
Connecting a Client
Open another terminal and connect with a nickname: bash
python pyrelay.py client --nick alice
Connect with a custom username: bash
python pyrelay.py client --nick alice --username alice123
To connect from another computer on the same network: bash
python pyrelay.py client \ --host 192.168.1.25 \ --port 6667 \ --nick alice
Replace 192.168.1.25 with the IP address of the computer running the server. Client Commands Join a Channel text
/join #general
Send a Public Message
After joining a channel, type a message normally: text
Hello everyone!
Send a Private Message text
/msg bob Hello privately
Show Channel Users text
/names #general
List Available Channels text
/list
Leave a Channel text
/part #general
Change Nickname text
/nick newname
Send an Action Message text
/me waves
Send a Raw IRC Command text
/raw WHO #general
Show Help text
/help
Disconnect text
/quit
Example Session
Start the server: bash
python pyrelay.py server
Connect the first client: bash
python pyrelay.py client --nick alice
Connect the second client: bash
python pyrelay.py client --nick bob
On both clients, join the same channel: text
/join #general
Alice can then send: text
Hello, Bob!
Bob can reply: text
Hi, Alice!
Alice can send Bob a private message: text
/msg bob This message is private.
Project Structure text
pyrelay/ ├── pyrelay.py ├── README.md └── LICENSE
Protocol Support
PyRelay implements a practical subset of the IRC protocol, including:
NICK
USER
JOIN
PART
PRIVMSG
NOTICE
NAMES
LIST
PING
PONG
QUIT
Basic IRC numeric responses
Security Notes
PyRelay is intended for learning, experimentation, and private network use.
It does not currently provide:
TLS encryption
User authentication
Password-protected channels
Persistent message history
Moderation controls
Rate limiting
Database storage
Avoid exposing the server directly to the public internet without adding appropriate security features. Future Improvements
Possible future additions include:
TLS support
User accounts and authentication
Operator permissions
Password-protected channels
Message history
File transfers
Rate limiting
Web-based client
Logging
Configuration files
Persistent channel settings
Start the server: bash
python irc.py server
Open another terminal and start a client: bash
python irc.py client --nick alice
Open a third terminal and start another client: bash
python irc.py client --nick bob
Then, in both clients: text
/join #general
You can now type regular messages. Useful commands include: text
/msg bob Hello privately /names #general /list /part #general /nick newname /quit
To connect from another computer on the same network, run the client using the server computer’s local IP address: bash
python irc.py client --host 192.168.1.25 --nick alice
The server uses port 6667 by default. You can choose another port with: bash
python irc.py server --port 7000