Why compiler shows error "Time Exceeds" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why compiler shows error "Time Exceeds"

#importing Socket library import socket #creating a socket s=socket.socket() #reserve a port number port = 1213 #Binding a port s.bind(('',port)) print("Socket Binded to port %s"%(port)) #Listing a socket s.listen(5) print("Socket is now Listning") #Creating loop until error occures or until it exists while True: c,addr = s.accept()

19th Apr 2019, 1:01 PM
Dipen Luitel
Dipen Luitel - avatar
4 Answers
+ 1
I know little about Socket but I'm pretty sure your loop doesn't stop when an error occurs or until a connection exists, but rather keeps on calling accept() infinitely.
20th Apr 2019, 4:42 AM
Diego
Diego - avatar
+ 1
Hmmm, u are great bro
20th Apr 2019, 4:43 AM
Dipen Luitel
Dipen Luitel - avatar
+ 1
https://docs.python.org/3/howto/sockets.html#creating-a-socket
20th Apr 2019, 4:52 AM
Diego
Diego - avatar
0
Bro but.. If i stop loop.. How can client connects to server...
20th Apr 2019, 4:46 AM
Dipen Luitel
Dipen Luitel - avatar