def recv_msg(sock, msg_len):
	"""Function for receiving fixed-length message from server"""

	msg = b''
	while len(msg) < msg_len:
		#try:
		chunk = sock.recv(min(msg_len, msg_len - len(msg)))
		#except:
			#print('Failed to receive message')
			#return
		if chunk == b'':
			return
		msg += chunk
	return msg