Crash: Multiple instances of chuck can't listen on the same OscIn port? (windows)
Crash: Multiple instances of chuck can't listen on the same OscIn port? (windows, debug build)
oscbug.ck
OscIn o;
0 => int sid;
57120 => o.port; // default SuperDirt port.
o.listenAll();
while(true)
{
o => now; // blocks
<<<"oscmsg", now>>>;
}
in two separate shells: % chuck oscbug.ck
in the second shell, chuck crashes and reports OscIn: error: cannot find free port.
The crash seems to occur during shutdown in server.c::lo_server_free, line 475-476.
close(s->sockets[i].fd);
s->sockets[i].fd = -1;
Visual Studio reports
Unhandled exception at 0x00007FFEE2B67FBC (ucrtbased.dll) in chuck.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
Aside from the crasher-bug, I wonder why OscIn should fail on a UDP broadcast listen? My cursory thinking on this is that UDP broadcasts should be observable by multiple parties (but I haven't thought too deeply on this).
cheers, Dana
Hi Dana, the following Stack Overflow post covers the details of listen port sharing/reuse far better than I could ever personally summarise:
https://stackoverflow.com/a/14388707