Flutter Unhandled Exception: SocketException: OS Error: Broken pipe, errno = 32, address = 10.0.2.2, port = 51420

Viewed 695

I am using Flutter with Flask at back end. I want to send an image from flutter to Flask for processing.

enter image description here

But I am getting this error in Android studio: [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: SocketException: OS Error: Broken pipe, errno = 32, address = 10.0.2.2, port = 51420

My flask terminal says: 127.0.0.1 - - [11/May/2021 23:07:56] "←[37mPOST / HTTP/1.1←[0m" 200 -

1 Answers

Your server process has received a SIGPIPE writing to a socket. This usually happens when you write to a socket fully closed on the other (client) side. This might be happening when a client program doesn't wait till all the data from the server is received and simply closes a socket (using close function).

In a C program you would normally try setting to ignore SIGPIPE signal or setting a dummy signal handler for it. In this case a simple error will be returned when writing to a closed socket. In your case a python seems to throw an exception that can be handled as a premature disconnect of the client.

Related