def _sendCurrentFrame(self): """ Sends the current image (based on currentFrameId) to the client through the dataSocket. """ (image, nextFrameId) = ResourceManager.getFrame(self._mediaId, self._currentFrameId) message = self._prepareMessage(self._currentFrameId, image) self._dataSocket.send(message) self._currentFrameId = nextFrameId
def _sendCurrentFrame(self): """ Sends the current image (based on currentFrameId) to the client through a socket created for the occasion. """ (image, nextFrameId) = ResourceManager.getFrame(self._mediaId, self._currentFrameId) messages = self._prepareMessages(self._currentFrameId, image) for fragment in messages: try: self._dataSocket.send(fragment) # Sometimes a 'no route to host' error happens, but we can just ignore it and keep trying again except OSError: pass self._currentFrameId = nextFrameId