GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: common: Improve binding of temporary address for Inet sockets · kohlschutter/junixsocket@40e9492

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • junixsocket-common/src/test/java/org/newsclub/net/unix/java
    • JavaAddressSpecifics.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎junixsocket-common/src/test/java/org/newsclub/net/unix/java/JavaAddressSpecifics.java‎

Copy file name to clipboardExpand all lines: junixsocket-common/src/test/java/org/newsclub/net/unix/java/JavaAddressSpecifics.java
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ public static SocketAddress wildcardBindAddress() throws IOException {
5353

5454
@Override
5555
public SocketAddress newTempAddress() throws IOException {
56-
return wildcardBindAddress();
56+
SocketAddress bindAddr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0);
57+
try (ServerSocket sock = new ServerSocket()) {
58+
sock.bind(bindAddr);
59+
return sock.getLocalSocketAddress();
60+
} catch (BindException e) {
61+
throw new TestAbortedException("Cannot bind to " + bindAddr, e);
62+
}
5763
}
5864

5965
@Override

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.