java - Netty client connect timeout from local -


i published netty service using dubbo(a alibaba distributed rpc framework). netty server ip 192.168.8.165. find strange thing.
    1. other lan computer service ok.(client 192.168.8.x => server 192.168.8.165:20880)
    2. computer 8.165, connecting netty service using address 192.168.8.165 timeout.(client 192.168.8.165 => server 192.168.8.165:20880)
    3. computer 8.165, connecting netty service using address 127.0.0.1 ok.(client 127.0.0.1 => server 127.0.0.1:20880)
    4. if 192.168.8.165 server connect lan net through cable (client 192.168.8.165 => server 192.168.8.165:20880) ok.
test using code:

private static final logger log = loggerfactory.getlogger(nettyclientcheck.class);  // using static channelfactory avoid memory leak. // see https://issues.jboss.org/browse/netty-424 private static final channelfactory channelfactory = new nioclientsocketchannelfactory(         executors.newcachedthreadpool(),         executors.newcachedthreadpool(),         runtime.getruntime().availableprocessors() + 1);  @test public void testconnect() throws exception {     string host = "192.168.8.165";     int port = 20880;      clientbootstrap bootstrap = new clientbootstrap(channelfactory);      bootstrap.setoption("keepalive", true);     bootstrap.setoption("tcpnodelay", true);     bootstrap.setoption("connecttimeoutmillis", 1000);      bootstrap.setpipelinefactory(() -> {         channelpipeline pipeline = channels.pipeline();         pipeline.addlast("handler", new channelhandler());         return pipeline;     });      channelfuture future = bootstrap.connect(new inetsocketaddress(host, port));      future.awaituninterruptibly(1000, timeunit.milliseconds);     channel channel = future.getchannel();     if (channel.isconnected()) {         log.info("succeeded connect");     } else if (future.getcause() != null) {         log.error("failed connect: ", future.getcause());     } else {         log.info("failed connect");     } }  private static class channelhandler implements channelupstreamhandler, channeldownstreamhandler {     @override     public void handleupstream(channelhandlercontext ctx, channelevent e) throws exception {         ctx.sendupstream(e);     }      @override     public void handledownstream(channelhandlercontext ctx, channelevent e) throws exception {         ctx.senddownstream(e);     } } 

i guess it's related network, totally don't know should fix it! or suggestion grateful.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -