F
F
fox7777777772021-12-25 22:11:15
Python
fox777777777, 2021-12-25 22:11:15

How to make a chat for three or more computers in python socket?

How to make a chat for three or more computers in python socket?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-12-26
@Vindicar

Give someone the server role, let him listen for connections and keep a list of already connected clients.
Upon receiving a message from a connected client, you need to forward it to everyone except the sender.
Clients simply listen for messages from the server and display them on the screen.
The alternative is to use broadcast UDP, but a TCP server is more reliable.
I would advise you to deal with asyncio, it can greatly simplify writing a server.
The most difficult thing will be to write the client, as it will be necessary to make asyncio friends with the client's user interface. Even elementary input() will be non-trivial to use.
So you can immediately use qasync to make pyqt and asyncio friends.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question