def update_state(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<EOL>sock.settimeout(self._timeout)<EOL>try:<EOL><INDENT>if sock.connect_ex((self._ip, self._port['<STR_LIT:state>'])) == <NUM_LIT:0>:<EOL><INDENT>self.state = True<EOL><DEDENT>else:<EOL><INDENT>self.state = False<EOL><DEDENT>sock.close()<EOL><DEDENT>except socket.error:<EOL><INDENT>raise<EOL><DEDENT>
Find out whether the media box is turned on/off.