scratchfoundation / scratch-link

Device interoperability layer for Windows and MacOS
BSD 3-Clause "New" or "Revised" License
104 stars 84 forks source link

Warn and exit gracefully when WebSocket port is already occupied #100

Closed cwillisf closed 5 years ago

cwillisf commented 5 years ago

Scratch Link opens its WebSocket server on port 20110.

Expected:

If port 20110 is already occupied, Scratch Link should display an error message and exit gracefully.

Actual:

The WebSocket library throws an exception which is not caught by the application, resulting in a crash.

cwillisf commented 5 years ago

Example stack trace:

Frame   Image   Function    Offset
0   System.ni.dll   System.Net.Sockets.Socket.DoBind    0x0000000000684FB1  
1   System.ni.dll   System.Net.Sockets.Socket.Bind  0x00000000000000E5  
2   Fleck.dll   Fleck.SocketWrapper.Bind    0x000000000000000A  
3   Fleck.dll   Fleck.WebSocketServer.Start 0x0000000000000032  
4   ScratchLink.exe scratch_link.App..ctor  0x0000000000000406  
5   ScratchLink.exe scratch_link.App.Main   0x0000000000000018