Netty Amazon Ec2
manish_iitg
excellencetechnologies08 at gmail.com
Fri Nov 27 06:00:39 EST 2009
I tried your method but it didnt work for me.
So i am bind on the private ip only.
there is the code i am using to dynamically get the private ip on the ec2
instance and bind to it
String ip = "";
try {
Process p = Runtime.getRuntime().exec("ec2-metadata -o");
BufferedInputStream input = new BufferedInputStream(p.getInputStream());
int x = 0;
StringBuffer result = new StringBuffer();
while ((x = input.read()) != -1) {
result.append((char) x);
}
input.close();
if (result.indexOf("local-ipv4: ") != -1) {
ip = result.substring("local-ipv4: ".length());
}
ip = ip.trim();
logger.info("Server binding to ip :" + ip);
} catch (IOException e1) {
e1.printStackTrace();
}
Channel channel = null;
if (ip.isEmpty())
channel = bootstrap.bind(new InetSocketAddress(999));
else
channel = bootstrap.bind(new InetSocketAddress(ip, 999));
Nicholas Hagen wrote:
>
> Wouldn't it be better to just bind to new InetSocketAddress(999) so that
> it accepts connections on any valid IP of the end device (ie: you can
> accept connections on both the elastic ip, localhost, and any other
> private IPs bound to that device). That' s typically what I do.
>
> Nick
>
> =================================
> Nicholas Hagen
> Z|NET Development, LLC
> www.znetdevelopment.com
> =================================
>
> On Nov 26, 2009, at 12:17 PM, manish_iitg wrote:
>
>>
>> Hello,
>>
>> I solved the problem.
>>
>> The problem was
>>
>> bootstrap.bind(new InetSocketAddress("127.0.0.1", 999)); in my server...
>>
>> but actually it should bind to the private ip of the instance. in my case
>>
>>
>> bootstrap.bind(new InetSocketAddress("10.210.xxx.xxx", 999));
>>
>>
>>
>>
>>
>> manish_iitg wrote:
>>>
>>> Hello,
>>>
>>> Has any one deplyed netty based server on ec2. I am facing a problem
>>> that,
>>> when i bind my netty based server on port 10001 it is not accessible
>>> from
>>> another ec2 instance. I know this is not a problem in netty, but of ec2
>>> configuration but if anyone faced this problem before and solved it let
>>> me
>>> know.
>>>
>>>
>>> Thanks
>>> Manish
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Netty-Amazon-Ec2-tp4070802p4072231.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
--
View this message in context: http://n2.nabble.com/Netty-Amazon-Ec2-tp4070802p4075206.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list