boost::asio - how to remotely connect to my server?

Started by
5 comments, last by breakspirit 12 years, 6 months ago
I've got a total noob question. I'm learning to use boost::asio and am playing with examples. Well, when I run a server, I can connect just fine using telnet if i connect to localhost and my specified port (telnet localhost 7777).
However, others can not connect via telnet to my server using my outside ip and the same port(which I did remember to forward). I feel like I'm missing something stupid and obvious. My listen command is below:

acceptor->Listen( "127.0.0.1", 25570 );

Thanks for any help.

Edit:
I thought of another question. I don't understand why the listen method needs my IP. My friend says its because you can have multiple IPs. Does that make sense?
Advertisement

I've got a total noob question. I'm learning to use boost::asio and am playing with examples. Well, when I run a server, I can connect just fine using telnet if i connect to localhost and my specified port (telnet localhost 7777).
However, others can not connect via telnet to my server using my outside ip and the same port(which I did remember to forward). I feel like I'm missing something stupid and obvious. My listen command is below:

acceptor->Listen( "127.0.0.1", 25570 );

Thanks for any help.

Edit:
I thought of another question. I don't understand why the listen method needs my IP. My friend says its because you can have multiple IPs. Does that make sense?


See the forum FAQ, the blue link near the top of the page. And yes, your friend is correct, as described in the FAQ.

Read the linked content inside FAQ entries #1, #9, and #18

There are several potential issues involved. I'd say NAT is the most likely, and since you have forwarding on your local router you might be behind two or more levels of NAT through your ISP.
Thanks for the reply. I've already read the FAQ and the suggested entries therein. It is mostly fluff. Upon further inspection, it was found that using my internal IP as the server IP would enable others to connect to me correctly. The line of code in question is show below:

acceptor->Listen( "192.168.11.2", 25570 );

Like I said, I knew it would be something stupid and simple.
Check this guy's journal out!
http://www.gamedev.n...with-boostasio/
Helped me out.

Edit: Realized you solved your problem. But still, that entry is a good read for ASIO.
my blog contains ramblings and what I am up to programming wise.

Check this guy's journal out!
http://www.gamedev.n...with-boostasio/
Helped me out.

Edit: Realized you solved your problem. But still, that entry is a good read for ASIO.


Yeah, that's exactly where I learned everything I know about asio. It was indeed a good read. Thanks for posting it.

Thanks for the reply. I've already read the FAQ and the suggested entries therein. It is mostly fluff. Upon further inspection, it was found that using my internal IP as the server IP would enable others to connect to me correctly. The line of code in question is show below:

acceptor->Listen( "192.168.11.2", 25570 );

Like I said, I knew it would be something stupid and simple.


What you reall want to listen to is "0.0.0.0" which is short-hand for "any available network interface" (INADDR_ANY in code).
enum Bool { True, False, FileNotFound };

[quote name='breakspirit' timestamp='1317242365' post='4866944']
Thanks for the reply. I've already read the FAQ and the suggested entries therein. It is mostly fluff. Upon further inspection, it was found that using my internal IP as the server IP would enable others to connect to me correctly. The line of code in question is show below:

acceptor->Listen( "192.168.11.2", 25570 );

Like I said, I knew it would be something stupid and simple.


What you reall want to listen to is "0.0.0.0" which is short-hand for "any available network interface" (INADDR_ANY in code).
[/quote]

You are a gentleman and a scholar.

This topic is closed to new replies.

Advertisement