mirror of
https://github.com/simh/simh.git
synced 2026-01-26 20:12:23 +00:00
SCP/TMXR: Fix to socket writes to return 0 bytes written as an expected condition when the output socket is full (EAGAIN or EWOULDBLOCK).
This commit is contained in:
13
sim_sock.c
13
sim_sock.c
@@ -1033,7 +1033,18 @@ return rbytes;
|
||||
|
||||
int32 sim_write_sock (SOCKET sock, char *msg, int32 nbytes)
|
||||
{
|
||||
return send (sock, msg, nbytes, 0);
|
||||
int32 err, sbytes = send (sock, msg, nbytes, 0);
|
||||
|
||||
if (sbytes == SOCKET_ERROR) {
|
||||
err = WSAGetLastError ();
|
||||
if (err == WSAEWOULDBLOCK) /* no data */
|
||||
return 0;
|
||||
#if defined(EAGAIN)
|
||||
if (err == EAGAIN) /* no data */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return sbytes;
|
||||
}
|
||||
|
||||
void sim_close_sock (SOCKET sock, t_bool master)
|
||||
|
||||
Reference in New Issue
Block a user