Skip to content

Commit 982ee21

Browse files
committed
Fix "ConnectionAbortedError" error on Windows
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine sock.sendall(msg)
1 parent 610124a commit 982ee21

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sdk/python/packages/flet/src/flet/sync_local_socket_connection.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ def __send(self, message: ClientMessage):
159159
def __send_msg(self, sock, msg):
160160
# Prefix each message with a 4-byte length (network byte order)
161161
msg = struct.pack(">I", len(msg)) + msg
162-
sock.sendall(msg)
163-
logging.debug("Sent: {}".format(len(msg)))
162+
try:
163+
sock.sendall(msg)
164+
logging.debug("Sent: {}".format(len(msg)))
165+
except Exception as e:
166+
logging.debug("Error sending a message over a socket: {}".format(e))
164167

165168
def __recv_msg(self, sock):
166169
# Read message length and unpack it into an integer

0 commit comments

Comments
 (0)