How to use fcntl.ioctl() to get output buffer of socket after sendall() operation - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: How to use fcntl.ioctl() to get output buffer of socket after sendall() operation (/thread-1165.html) |
How to use fcntl.ioctl() to get output buffer of socket after sendall() operation - apsaxena - Dec-09-2016 I am trying to get the pending data size in output buffer after calling my socket's sendall(). I am using TCP (non-blocking) socket in a class. My code for send message function in the class is as follows: def send_data(self, msg): try: status_of_send = self.client.sendall(msg) buffer = array.array('I', [0]) pending = fcntl.ioctl(self.tcp_socket.fileno(), termios.TIOCOUTQ, buffer, True) print pending except socket.error as e: print 'Error while sending data: %s', eOn calling to this function, an Error is occurring as follows: TraceBack (most recent call last): File "server.py", line 199, in send_date pending = fcntl.ioctl(self.tcp_socket.fileno(), termios.TIOCOUTQ, buffer, True) IOERROR: [Errno 22] Invalid argumentCan any one help me with this?? |