I am pausing the devel here, I have to prioritise another project.
Doctests seems to be obsolete for testing network scripts.
I'll be back with Pytest!
Adds `server_log()` method in order to export the `print()` calls.
Centralize _log_, _broadcast_ & _send_ operations in the bottom of the
loop (except when sockets needs to be close).
I think it is improves readability and will facilitate code evolution,
for example when writing the servers log in file(s).
Now sends messages only to named-client, and for that uses
`list_sockets()`
Takes sender name from `_user_name` attribute and delete the name
argument from the method
`list_sockets()` uses only clients with a name already typed in
(filled in `_user_name` attribute), to avoid starting a game with not
named player
`count_clients()` was too messy and autonomous, now it uses
`list_sockets()` for counting only named players and not depend on
naming player mechanism or main socket.# Veuillez saisir le message de
validation pour vos modifications. Les lignes
Traceback (most recent call last):
File "server.py", line 78, in <module>
peername = socket.getpeername()
OSError: [Errno 107] Transport endpoint is not connected
- convert logic to oreiented object
- server crash witn opened connection with <ctrl+Z>
- add some commands: help, list user, disconnect user, etc
- add time logging:
- a timestamp in log's server
- brodcast time to client at regular intervals
- UPDATE: last condition for messages passing the commands case and
the string.stripping()
- FIX: clean the prompt and std.out a bit messy since broadcasting
Remove:
- try/catch for received case, seems to be useless
- useless `continue`
- **move closing connection at the script's end** from TODO, do not find how to exit while from handler()