def next_frame_size(socket):
 try:
  data = read_exactly(socket, 8)
 except SocketError:
  return 0
 (_, actual) = struct.unpack('>BxxxL', data)
 return actual

def next_frame_size ( socket ) : try : data = read_exactly ( socket , 8 ) except SocketError : return 0 ( _ , actual ) = struct . unpack ( '>BxxxL' , data ) return actual
returns the size of the next frame of data waiting to be read from socket .