Opened 6 years ago

Closed 6 years ago

#1661 closed enhancement (fixed)

Option to use SO_REUSEADDR for TCP and TLS listeners and use it by default on non-Windows platforms

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.2
Component: pjsip Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

Compile time and run-time options to use SO_REUSEADDR for SIP TCP and TLS transports. The run-time options are pjsip_tcp_transport_cfg.reuse_addr and pjsip_tls_setting.reuse_addr, and pj_ssl_sock_param.reuse_addr for the lower level PJSIP's SSL socket.

The default value for those settings are taken from these new compile time macros: PJSIP_TCP_TRANSPORT_REUSEADDR and PJSIP_TLS_TRANSPORT_REUSEADDR. By default, these macros will be set to 1 on non-Windows platforms, meaning that SO_REUSEADDR will be set to the listener sockets, and zero on Windows platforms (including mobile).

The reason why it's not set by default on Windows is because this option will steal the port from other program even if that program is currently active and the socket has not been closed. See this MSDN page for more info.

Change History (1)

comment:1 Changed 6 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed

In 4506:

Fixed #1661: Option to use SO_REUSEADDR for TCP and TLS listeners and use it by default on non-Windows platforms

Note: See TracTickets for help on using tickets.