if (sockaddr instanceof InetSocketAddress) {
InetAddress addr = ((InetSocketAddress) sockaddr).getAddress();
short port = (short) ((InetSocketAddress) sockaddr).getPort();
if (addr instanceof Inet4Address) {
if (sockaddr instanceof InetSocketAddress) {
InetAddress addr = ((InetSocketAddress) sockaddr).getAddress();
short port = (short) ((InetSocketAddress) sockaddr).getPort();
if (addr instanceof Inet4Address) {
try {
Peer peer = setup_socket(chan);
peer.key = chan.register(this.selector, SelectionKey.OP_READ, peer);
try {
Peer peer = setup_socket(chan);
peer.key = chan.register(this.selector, SelectionKey.OP_READ, peer);
Result_NonePeerHandleErrorZ res = this.peer_manager.new_inbound_connection(peer.descriptor, netaddr);
if (res instanceof Result_NonePeerHandleErrorZ.Result_NonePeerHandleErrorZ_Err) {
peer.descriptor.disconnect_socket();
Result_NonePeerHandleErrorZ res = this.peer_manager.new_inbound_connection(peer.descriptor, netaddr);
if (res instanceof Result_NonePeerHandleErrorZ.Result_NonePeerHandleErrorZ_Err) {
peer.descriptor.disconnect_socket();
* @param timeout_ms The amount of time, in milliseconds, up to which we will wait for connection to complete.
* @throws IOException If connecting to the remote endpoint fails or internal java.nio errors occur.
*/
* @param timeout_ms The amount of time, in milliseconds, up to which we will wait for connection to complete.
* @throws IOException If connecting to the remote endpoint fails or internal java.nio errors occur.
*/
- public void connect(byte[] their_node_id, SocketAddress remote, int timeout_ms) throws IOException {
+ public void connect(byte[] their_node_id, java.net.SocketAddress remote, int timeout_ms) throws IOException {
* @param socket_address The address to bind the listening socket to.
* @throws IOException if binding the listening socket fail.
*/
* @param socket_address The address to bind the listening socket to.
* @throws IOException if binding the listening socket fail.
*/
ServerSocketChannel listen_channel = ServerSocketChannel.open();
listen_channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
listen_channel.bind(socket_address);
ServerSocketChannel listen_channel = ServerSocketChannel.open();
listen_channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
listen_channel.bind(socket_address);