I created a UDP communicator. If I receive a message of size larger than recv() accepts, then I want to handle the exception:
OSError: [WinError 10040] A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself.
How can I do that? Is it safe to handle WinError like:
try:
message, comm_point = self.clientSocket.recvfrom(MSG_SIZE)
except WinError:
...do some job
I know, that WinError.h is a quite large library and it seems to me, that at the time of the try block I may handle some other WinErrors, if the system invokes them...