From c20042bdbd44eb30ea2f74d0ea0b311e6aa053e9 Mon Sep 17 00:00:00 2001 From: Justin Cameron Date: Tue, 17 Nov 2026 18:17:59 -0500 Subject: [PATCH] m65common: non-blocking TCP reads on macOS too do_serial_port_read() passed MSG_DONTWAIT to recv() everywhere except macOS, where the read blocked. Callers such as purge_input() read until nothing is left, so over tcp# m65.osx and mega65_ftp.osx hang right after connecting (m65.osx -l tcp#host:4510 -S0 stops after the Xemu check), whatever the server. macOS supports MSG_DONTWAIT; use it on both. Co-Authored-By: Claude Opus 5.5 --- src/tools/m65common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tools/m65common.c b/src/tools/m65common.c index 5c585fce..11c8da1c 100644 --- a/src/tools/m65common.c +++ b/src/tools/m65common.c @@ -1509,11 +1509,9 @@ size_t do_serial_port_read(int fd, uint8_t *buffer, size_t size, const char *fun int count; if (serial_port_is_tcp) { -#ifndef __APPLE__ + // Non-blocking like the serial port: callers such as purge_input() + // read until nothing is left, and a blocking recv() would hang there. count = recv(fd, buffer, size, MSG_DONTWAIT); -#else - count = recv(fd, buffer, size, 0); -#endif } else count = read(fd, buffer, size);