For example:
Code: Select all
>>> import network
>>> import socket
>>> ap_if = network.WLAN(network.AP_IF)
>>> ap_if.active(True)
>>> s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
>>> s.bind(("<IP_OF_SERVER>",<SOME_PORT>)
>>> doing_some_stuff() #calling a function here, which will need some time to execute!
#During doing_some_stuff() a connected client is sending a UDP-packet to the socket (s), with socket.sendto()
#after finishing doing_some_stuff() it is possible to call s.recv(bufsize), for receiving the UDP-packet which was sent during doing_some_stuff()!
>>> s.recv(1024)
b"someData" #received data
Is it possible to receive more the one UDP-packet - how?
(one solution will be, that the server use more than one socket, with another port - and the client will send the next packet to the next socket and port - but is it possible to use the same socket?)