1
0
mirror of https://github.com/simh/simh.git synced 2026-01-26 12:02:14 +00:00

SOCK: Add an option to specify a listen backlog

This commit is contained in:
Mark Pizzolato
2023-06-08 00:53:49 -10:00
parent 2e7a109bb8
commit b2983bd214
2 changed files with 6 additions and 2 deletions

View File

@@ -1045,7 +1045,7 @@ if (!(opt_flags & SIM_SOCK_OPT_BLOCKING)) {
if (sta == SOCKET_ERROR) /* fcntl error? */
return sim_err_sock (newsock, "setnonblock");
}
sta = listen (newsock, 1); /* listen on socket */
sta = listen (newsock, SIM_SOCK_OPT_BACKLOG(opt_flags));/* listen on socket */
if (sta == SOCKET_ERROR) /* listen error? */
return sim_err_sock (newsock, "listen");
return newsock; /* got it! */
@@ -1329,8 +1329,10 @@ int sim_read_sock (SOCKET sock, char *buf, int nbytes)
int rbytes, err;
rbytes = recv (sock, buf, nbytes, 0);
if (rbytes == 0) /* disconnect */
if (rbytes == 0) { /* disconnect */
err = WSAGetLastError ();
return -1;
}
if (rbytes == SOCKET_ERROR) {
err = WSAGetLastError ();
if (err == WSAEWOULDBLOCK) /* no data */