W
W
wenzeslaus2021-11-28 02:55:58
Python
wenzeslaus, 2021-11-28 02:55:58

What could be the server problem and how to solve it?

I just started to learn the socket module and decided to try to make a local server, and at the first start the problems started. Here is the code

import socket
server = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
server.bind(("127.0.0.1", 21356))
server.listen()
while True:
    user, adres = server.accept()

turned off the firewall, the antivirus too, but such an error comes out, the
61a2c52e92dc9316160260.png
question may seem silly and simple, but it’s really not clear to me what could be the problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-11-28
@wenzeslaus

UDP sockets do not use listen()/accept().
You can immediately do socket.recvfrom()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question