Open priime0 opened 9 months ago
I think I'm missing an ingedient, since I have not been able to replicate this behavior on macOS 13 or 14. For the server's address as used by the client, I've tried using "localhost" and the IPv4 address associated with en0.
Are you using the address associated with en0 on the server, or something else?
Do you see this behavior on just one macOS machine as the server, or on more than one (if you have multiple machines available to try)?
When we compiled to a standalone executable, it would work when running both programs on the same Mac, but we observed that it would fail to connect only when using the Mac as a server for another machine to connect to.
As for the address, we were using "localhost" for the machine, and we have also tried using the broadcast feature, so both of (tcp-listen 10001 <max-allow-wait> <reuse?> #f)
and (tcp-listen 10001 <max-allow-wait> <reuse?> "localhost")
with various configurations for the other two arguments.
When two machines are involved, then using "localhost"
certainly won't work. Even if "localhost"
is used only for tcp-listen
, that constrains the listener to accept connections only on the loopback device.
There may be some confusion here with the notion of "broadcast" address. Using #f
as the last argument for tcp-listener
isn't related to the broadcast address, 255.255.255.255, on a given network. A #f
last argument means to listen at all the devices available on the server machine, where each device will have its own specific IP address for the network that it's connected to. A second machine would have to use that IP address to refer to the listener on the relevant network.
What version of Racket are you using?
8.10 CS
What program did you run?
Assume the server has the IP address of
255.255.255.255
.server.rkt (MacOS -- see OS details at the bottom):
client.rkt (Linux (Arch)):
Expected behaviour:
The connection resolves.
Observed behaviour:
When
server.rkt
is run on MacOS with the commandracket server.rkt
, andclient.rkt
is run on Linux with the commandracket client.rkt
, the connection resolves.When
server.rkt
is compiled to an executable with one of the following three shell commands:and then run with
./server
, andclient.rkt
is run (either compiled to an executable or run directly with theracket
shell command, thentcp-accept
hangs, looping forever.This behaviour is not observed if Linux runs
server.rkt
, either compiled to an executable or run directly with theracket
shell command. It is also not observed if we runraco make server.rkt
andracket server.rkt
.Please include any other relevant details
Possible issues:
CC @AndreyPiterkin
MacOS: