Skip to content

Commit

Permalink
Added exception handling to conn.sendall
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitgohel1996 committed Sep 16, 2018
1 parent 44e2f84 commit 5c9d3ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def threaded(conn):
return

retData = retData[:-1] # to remove the final \n
conn.sendall(retData) # send all will break down text in small packets and then send all the packets

try:
conn.sendall(retData) # send all will break down text in small packets and then send all the packets
except socket.error as e:
print 'Error occured'

conn.close() # close the connection

Expand Down

0 comments on commit 5c9d3ab

Please sign in to comment.