Hello, I have a question on netty hosting outside localhost

65 views
Skip to first unread message

goodnews...@gmail.com

unread,
Dec 27, 2016, 4:43:08 PM12/27/16
to Netty discussions
Hello,

I have a client<>server application.

It works well at 127.0.0.1

But when I try and host via IP, I'm not connecting.

I more than triple checked my port forwarding and windows firewall and antivirus to be right.

I remember the last time I used a Netty server that I had to set the server's host ip somewhere, but I can't even find 127.0.0.1 or localhost in a search to change it over.

I'm using a slightly modified discard server.

Here is some possibly relevant code:


EventLoopGroup bossGroup = NioEventLoopGroup(1);
EventLoopGroup workerGroup = NioEventLoopGroup(2);

Try{
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>()
{...})
.option(ChannelOption.SO_BACKLOG, 128)
.childoption(ChannelOption.SO_KEEPALIVE,true);

ChannelFuture f = b.bind(port).sync();



Do I need to place somewhere the IP address that I'm listening on?
Or what I am I missing.

goodnews...@gmail.com

unread,
Dec 27, 2016, 5:07:27 PM12/27/16
to Netty discussions
I might be able to score you beta testing and maybe retail loot if you can help.

www.reddit.com/r/battlemon

goodnews...@gmail.com

unread,
Dec 28, 2016, 12:49:00 AM12/28/16
to Netty discussions
I think the problem stems from my router not having hair pinning.

If I plug into the modem apart from the router, my game runs fine.

Zhu Ran

unread,
Jan 9, 2017, 11:06:57 AM1/9/17
to Netty discussions, goodnews...@gmail.com
At last line of your code:
    ChannelFuture f = b.bind(port).sync();
you can use another version of bind method of ServerBootstrap Class, 
and pass an address as the first argument. Just like this:
        ChannelFuture f = b.bind("localhost", port).sync();
Reply all
Reply to author
Forward
0 new messages