equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
45 ServerSocket srv = null; |
45 ServerSocket srv = null; |
46 int port = 0; |
46 int port = 0; |
47 int tout = 1000; |
47 int tout = 1000; |
48 |
48 |
49 sin = InetAddress.getLocalHost(); |
49 sin = InetAddress.getLocalHost(); |
50 srv = new ServerSocket(port); |
50 srv = new ServerSocket(); |
|
51 srv.bind(new InetSocketAddress(sin, 0)); |
51 port = srv.getLocalPort(); |
52 port = srv.getLocalPort(); |
52 soc = new Socket(sin, port); |
53 soc = new Socket(sin, port); |
53 soc1 = srv.accept(); |
54 soc1 = srv.accept(); |
54 soc.setSoTimeout(tout); |
55 soc.setSoTimeout(tout); |
55 |
56 |