RTC Forums
March 28, 2024, 10:27:59 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Address already in use error on Linux  (Read 3543 times)
Max Terentiev
RTC License
***
Posts: 49


« 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.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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 Wink

Please, download RTC SDK v8.05 (just released) and let me know if the problem is now fixed.

Best Regards,
Danijel Tkalcec
Logged
Max Terentiev
RTC License
***
Posts: 49


« Reply #2 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 ?

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.