Title: Address already in use error on Linux Post by: Max Terentiev on June 01, 2017, 11:14:58 PM Hi Danijel,
I'm trying RTC SDK on Linux using FPC/Lazarus. Looks like it's works but I have annoying "Address already in use" exception after restarting my server if at least one client has been connected before. This exception happens if server restarted immediately. If I wait a minute before restart - it's works fine. Looks like problem with TIME_WAIT connections and SO_REUSEADDR option. After some debugging I found where is a problem: fpSetSockOpt(FSocket, SOL_SOCKET, SO_REUSEADDR, buf, SizeOf(optval)) should be called BEFORE Sock_Err(fpBind(FSocket, @Sin, SizeOfVarSin(Sin))) in rtcSynApi.TRtcSocket.Sock_Bind You current implementation set SO_REUSEADDR option in TRtcSocket.Sock_SetDelay wich called AFTER bind ! Because of it "Address already in use" raised under linux if exists some connections in TIME_WAIT state. This should be done only for FPC/Linux because I never see this problem on Windows. Hope you fix it in next version. Title: Re: Address already in use error on Linux Post by: D.Tkalcec (RTC) on June 02, 2017, 11:01:18 AM Thanks for reporting this issue. I don't use Linux, but I will take your word for it ;)
Please, download RTC SDK v8.05 (just released) and let me know if the problem is now fixed. Best Regards, Danijel Tkalcec Title: Re: Address already in use error on Linux Post by: Max Terentiev on June 02, 2017, 02:40:22 PM Thank you very much, it's works now !
I trying to write simple web service app for Linux using RTC SDK and Lazarus/FPC. I know that you not support Linux but I can test RTC against it and report about all found issues. At least I will use HttpServer, HttpClient, ServerModule, ClientModule, FunctionGroup, Functions, Results. Do you need my bug reports about RTC SDK issues on Linux ? Title: Re: Address already in use error on Linux Post by: D.Tkalcec (RTC) on June 02, 2017, 02:56:29 PM Since I am NOT using Linux, I will NOT be able to debug any issues you might find on Linux, but ... if you bump into any problems on Linux and find a solution, it might be a good idea to report the problem and include your fix, so I can check it against other platforms and include it in the official RTC SDK release. That way, you won't have to apply the same fix manually after every RTC SDK update.
Best Regards, Danijel Tkalcec |