winsock client server

May 15, 2010 at 12:10pm
I have a client program and a server program that runs on winsock. When i run the server and in the client type address 127.0.0.1 as server address it connects as it should. So is it enough just to change the address to be able to connect from computer that is somewhere outside local network? If so then what address it is?
May 15, 2010 at 12:25pm
If so then what address it is?
... It is one from around 2100 possible ones...

If you are using a router to connect to the internet, then you might look in its interface or within the software that was shipped with it.

Or You can simply ask the person for their IP (but he/she/it) needs to know its adress, too^^...

You may also use some Dynamic DNS Service, which creates an human-readable address (e.g. a link) for you (if you want one) and associates it with your dynamic IP.(http://www.no-ip.com/)
May 15, 2010 at 12:59pm
Well i didn't ment you to say the actual address... I found out few ip addresses like the one from http://www.ip-adress.com/ (which is always the same all that kind of sites see) and others by typing ipconfig in cmd. I've tried to use the first one, but either i was doing something wrong or it didn't worked. Yes, I have a router. So I first need to know the actual address that should really work before changing the code. And as in my own computer client worked i think maybe the address is wrong.

So, how can i find out the address i could use to connect to my computer? Thanks in advance.

(I'm trying to crate something-like-chat server-client type program for my informatics semester finishing job, but i'm stuck in here...)
May 16, 2010 at 10:50am
It seems that i needed to forward ports from my router.
May 16, 2010 at 11:07am
Let´s break it down into two steps, an go them one after another...

You should realize, that the IP-address in your LAN is different from the one your router is assigned in the internet (because every "access" to/from the internet ,concerning your computer, is made through the router - in your case).

So if You want someone to connect to You from the internet, you need him to know your routers IP...
As I did mention before, you usually can look up the IP in the router itself (access its menu or via the software provided by the routers manufacturer, or via UPNP -if supported)...

BUT... since your IP address changes dynamically after each reconnect (usually), it will change every day (estimated)... you can "fix" this by going (e.g.) to the link i posted above and create and account, to redirect your IP to some static IP, that You can choose (like google, web.de, msn, etc... )...
After u done this, You and your client are able to use this "name" to connect to each other, because it will be resolved to your IP-address (but u need some kind of software/router setting , which tells the DNS-provider your IP address periodically)...
[It´s not very hard to set things up - don´t be scared of the text amount :D]...

2. Yepp... You need to forward the ports you are using... Either set it in the router interface or use UPNP http://cplusplus.com/forum/windows/22896/
Last edited on May 16, 2010 at 11:08am
May 16, 2010 at 2:09pm
Thank you for answer. Yes, i've already realized that, so i changed my ip address to static (it looks like it works, since i have internet after restart), but now i have a problem that has nothing to do with c++... Somehow when i try to set any port forwarding the router just don't save changes. Although i can change other things, and it works. For forwarding it says that the change was successful, but changes nothing.

I've posted that issue on other forum related to that kind of problems, but still no answer...
May 16, 2010 at 3:56pm
Does that mean, after a change is made, the router does not show the new option set?... Or it is still there after you relogin and just does not work? (which router are You using?...
May 16, 2010 at 5:58pm
After the change is made, the router does not show the new option set. But, as i mentioned before, i can change other options, so that should not (i think) be the case of some privileges. My router is Linksys WRT54G2.
May 16, 2010 at 7:39pm
Ok i got it! Before forwarding ports it is needed to change some security checkboxes - uncheck "Block anonymous internet requests" and check "Filter multicast". Before doing this router does not save changes without any warning...
May 16, 2010 at 9:22pm
Everything works fine, now?...
May 17, 2010 at 9:07am
Yes, now i can send data fine from any computer :)
Topic archived. No new replies allowed.