0

In java how to set SO_EXCLUSIVEADDRUSE flag to serversocket?

Am not able to find the API call for this in ServerSocket API.

I can set SO_TIMEOUT using setSoTimeout method. But how to set SO_EXCLUSIVEADDRUSE?

Praveen Kumar
  • 946
  • 3
  • 10
  • 29
  • From Java 7u25 onwards [it's set by default](https://stackoverflow.com/questions/16591973#49589944). – antak Mar 31 '18 at 16:27

1 Answers1

1

If there isn't an API for it you can't do it.

This option only appears to exist on Windows: it would be pointless implenenting it in a cross-platform language. It seems to be a compensation for a broken implementation of SO_REUSEADDR. You don't need it on platforms without that problem.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Just because it is Windows only does not mean it is not possible or won't be added. One example is [TCP Loopback Fast Path](http://mail.openjdk.java.net/pipermail/net-dev/2014-September/008685.html). Although yes, this would need to be set as a vm argument (and first supported). – Obicere Nov 24 '14 at 19:43
  • `If there isn't an API for it you can't do it.` There is no API, therefore you can't do it. – Obicere Nov 26 '14 at 04:22