0

I have this code on a small server that is getting requests from a client using SCTP connection, I keep getting this error every now and then.

BlockingIOError: [Errno 11] Resource temporarily unavailable

I know that I can avoid it by using Try-except but I wanna have a deep understanding of the issue. any help?

my code is here. this is the server

server = ('', 29168)
sk = sctpsocket_tcp(socket.AF_INET)
sk.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sk.bindx([server])
sk.listen(5)
connection, addr = sk.accept()
while c:
      a,b,c,d = connection.sctp_recv(1024)
      print(c)
zizoujab
  • 7,603
  • 8
  • 41
  • 72
ratebaltal
  • 47
  • 6
  • Your server is single-threaded, so it is stuck with the first client until it disconnects. If you try to connect from two separate clients, you need a forking or threaded server, or an async architecture (each client gets a callback which the server loop services in between handling other clients and other tasks). – tripleee Nov 28 '17 at 12:33
  • @tripleee if I make my server multi-threaded, I won't see this error anymore ? – ratebaltal Nov 28 '17 at 13:18
  • If I were certain that this is the problem, I would have posted this as an actual answer. There is a large number of things which could be going wrong, but I thought this was useful speculation. – tripleee Nov 28 '17 at 13:19
  • @tripleee Okay thanks mate ! – ratebaltal Nov 28 '17 at 13:33

1 Answers1

0

After going again through the SCTP library, I found a closed issue on Github with the solution

ratebaltal
  • 47
  • 6