Netty 4-in-vm短暂频道

时间:2013-12-05 03:58:12

标签: netty

我正在寻求从我们当前的Netty 3.x迁移到新的Netty 4.x,但我没有看到等同于3.x的(org.jboss.netty.channel.local.LocalAddress)短暂的地址。新的包结构中有一个等价的类,但看起来它用于不同的目的,更不用说包私有构造函数。

有谁知道如何将3.x临时地址迁移到4.x?迁移文档中似乎没有任何内容。 http://netty.io/wiki/new-and-noteworthy.html

客户端连接:

    int port = 10000;
    ClientBootstrap clientBootstrap = new ClientBootstrap();
    clientBootstrap.connect(new LocalAddress(port));

服务器连接:

    int port = 10000;
    ServerBootstrap serverBootstrap = new ServerBootstrap();
    serverBootstrap.bind(new LocalAddress(port));

由于

1 个答案:

答案 0 :(得分:0)

道歉。我没有意识到LocalAddress构造函数已从LocalAddress(int)更改为LocalAddress(String)。所以在Netty 4.x中它现在是

int port = 10000;
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.bind(new LocalAddress(Integer.toString(port)));
相关问题