This repository contains a simple Python implementation showcasing socket communication between a server and a client using threading. The code is organized into two classes, ServerNode
and ClientNode
, demonstrating a basic messaging system.
The ServerNode
class represents the server side of the communication. It initializes a socket, binds it to a specific IP address and port, and listens for incoming connections. Once a connection is established, it accepts it and allows for sending and receiving messages.
send_sms(SMS)
: Sends the provided SMS (Short Message Service) string to the connected client.receive_sms()
: Continuously listens for incoming messages from the connected client and prints them to the console.main()
: Main loop for the server, allowing the user to input messages for sending.
The ClientNode
class represents the client side of the communication. It initializes a socket and connects to the specified server's IP address and port. Similar to the server, it provides methods for sending and receiving messages.
send_sms(SMS)
: Sends the provided SMS string to the connected server.receive_sms()
: Continuously listens for incoming messages from the server and prints them to the console.main()
: Main loop for the client, allowing the user to input messages for sending.
- Run the server script (
server.py
) in one terminal window. - Run the client script (
client.py
) in another terminal window. - Start typing messages in the client's terminal to send them to the server.
- Messages received from the server will be displayed in the client's terminal.
This project is licensed under the GNU General Public License v3.0.
Feel free to contribute by submitting issues or pull requests.
- Special thanks to contributors and developers who have helped improve this project