Приложение на Python, демонстрирующее общение потоковых сокетов (сервера и клиентов) вида "Запрос домена"-"Отправка соответствующего/-их ip-v4 запрашиваемого домена" c учетом многопоточной обработки запросов от клиентов и установкой личной сессии.
Почти все функции работы с сокетами как с стороны клиента так и сервера могут кидать исключения.
Traceback (most recent call last):
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/client.py", line 43, in
main()
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/client.py", line 40, in main
create_client('localhost', 10000)
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/client.py", line 29, in create_client
ClientSocket.sendall(ques)
BrokenPipeError: [Errno 32] Broken pipe
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/server.py", line 63, in
main()
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/server.py", line 60, in main
create_server('localhost', 10000)
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/server.py", line 45, in create_server
object_conn, address = ServerSocket.accept()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py", line 295, in accept
fd, addr = self._accept()
^^^^^^^^^^^^^^
KeyboardInterrupt
такие вещи надо обрабатывать для адекватного завершения приложения
https://github.com/alesiatants/Client_Server_Host_To_IP_With_Threading/blob/b453210548c875794fe4780595cf8e95a5383cae/Client_Server_DNS_IP_Thread/client.py#L31
Почти все функции работы с сокетами как с стороны клиента так и сервера могут кидать исключения.
Traceback (most recent call last): File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/client.py", line 43, in
main()
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/client.py", line 40, in main
create_client('localhost', 10000)
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/client.py", line 29, in create_client
ClientSocket.sendall(ques)
BrokenPipeError: [Errno 32] Broken pipe
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/server.py", line 63, in
main()
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/server.py", line 60, in main
create_server('localhost', 10000)
File "/Users/i.nemshilov/playground/python/Client_Server_Host_To_IP_With_Threading/Client_Server_DNS_IP_Thread/server.py", line 45, in create_server
object_conn, address = ServerSocket.accept()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py", line 295, in accept
fd, addr = self._accept()
^^^^^^^^^^^^^^
KeyboardInterrupt
такие вещи надо обрабатывать для адекватного завершения приложения