I did run a local test and indeed you get a bind exception if trying to bind a local port that's in use as server port:
https://github.com/galderz/java-sandbox/blob/master/src/main/java/j/net/LocalPortClash.java I'll check JGRP source and JIRA and try to dig this further. Cheers, > On 14 Aug 2017, at 08:48, Bela Ban <bela...@mailbox.org> wrote: > > Right: the localHost:localPort combo of the client socket cannot be the > same as that of the remoteHost:remotePort. > > Do you happen to have the link to the JGroups issue? I also remember > this, but googling I failed to find it. Perhaps we can use the same > solution here that we used for the JGRP issue. > > I vaguely recall we checked the client's local address:port against some > server address:port and closed/re-created it is the same. > > On 11/08/17 20:56, Dennis Reed wrote: >> On 08/11/2017 11:50 AM, Galder Zamarreño wrote: >>> I must admit this scenario sounds very weird... how does Java allow you for >>> a local port to be bound to a port that's already in use by the server? It >>> doesn't make sense. >> >> You cannot bind to a port that's already in use. >> >> But if you're trying to connect to a port in the ephemeral range that's >> not in use, and the OS happens to assign that same IP:port to the local >> socket, it can connect to itself. >> >> (We've run into this in JGroups before, and it was a pain to track down >> what was going on). >> >> -Dennis >> _______________________________________________ >> infinispan-dev mailing list >> infinispan-dev@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/infinispan-dev >> > > -- > Bela Ban | http://www.jgroups.org > > _______________________________________________ > infinispan-dev mailing list > infinispan-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/infinispan-dev -- Galder Zamarreño Infinispan, Red Hat _______________________________________________ infinispan-dev mailing list infinispan-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/infinispan-dev