PDA

Click to See Complete Forum and Search --> : Winsock over Internet


Nafto
Jan 18th, 2005, 09:00 PM
Hey, ok so winsock works if i loop back to my self with 127.0.0.1 or if i connect to a server on another computer with it's ip, if the computer is on the same network.
How do I connect to a computer that's completely independent from mine except that it's connected to the internet, and has my client or my server?
If I do the same thing just change the 127.0.0.1 to the person's ip address nothing happens at all.

Pino
Jan 19th, 2005, 02:39 AM
Hey, ok so winsock works if i loop back to my self with 127.0.0.1 or if i connect to a server on another computer with it's ip, if the computer is on the same network.
How do I connect to a computer that's completely independent from mine except that it's connected to the internet, and has my client or my server?
If I do the same thing just change the 127.0.0.1 to the person's ip address nothing happens at all.

All you need to do is change the IP, and make sure both the client/server app are using the same port,

It should work could you show be your connection and listening code? And also the Pc You are aconnecting to, is it behind a router? Or withing another network?

Pino

Nafto
Jan 19th, 2005, 02:54 PM
I'm using a working code, I am sure of it. I am not by my computer that has it now but I know it works, it worked when I connected to myself, and it worked on another computer at my school on the network. So I had a server and client running on two of my school computers and when I changed the IP it worked.

I am actually behind a router. I tried doing if with my computer which is connected to my brother's router wirelessly, to my laptop which was right next to me which was using the same wireless connection. I also tried with my wireless connection to my friends computer at his house, and I don't know what connection he has.

Pino
Jan 19th, 2005, 02:58 PM
I'm using a working code, I am sure of it. I am not by my computer that has it now but I know it works, it worked when I connected to myself, and it worked on another computer at my school on the network. So I had a server and client running on two of my school computers and when I changed the IP it worked.

I am actually behind a router. I tried doing if with my computer which is connected to my brother's router wirelessly, to my laptop which was right next to me which was using the same wireless connection. I also tried with my wireless connection to my friends computer at his house, and I don't know what connection he has.

What it is, is that you can connect from behind your router but the ip your friend is giving you may be the ip off his/her router its hard to get an ip of a computer behind a router you would have to set up port forwarding on the router, thats if they have a router ;)

Nafto
Jan 19th, 2005, 05:12 PM
You're right, the IP address I got was the same for my computer and for my laptop, which means it was the router's. Thanks, but how do I do this port forwarding to fix it? If possible I'd like to do this from my program somehow, so if I give it to someone who has a router they'll be able to use it too.

Pino
Jan 19th, 2005, 05:22 PM
You're right, the IP address I got was the same for my computer and for my laptop, which means it was the router's. Thanks, but how do I do this port forwarding to fix it? If possible I'd like to do this from my program somehow, so if I give it to someone who has a router they'll be able to use it too.

as long as one of you doesnt have a router you should be ok, Ie when i'm playing UT2004 with friends i cant host a game because i'm behind a router, but i can connect to any of them because they arnt behind a router and the ip they get is a true reflection of the PC they use (I'm not 100% with IP's and networks but i know the basics)

To do the port forwarding its dependant on the router itself you may be best going to the routers home page and see if they support it,

I have tried port forwarding with my router but i've never managed to get it working maybe i'm just doing it wrong though ;) (I have no need for it now anyways)

Hope that helps :)

Nafto
Jan 19th, 2005, 05:25 PM
ok i'll go to the website. So if I get a game like counter-strike (which i am actually thinking of) I'm not going to be able to host a game cuz my router... I can't think that there isn't a solution... are you telling me all those big online games, like half the people can't play them correctly?

[EDIT] I went to the site, and it said absolutely nothing about port forwarding. So what is that really?

[edit] I don't think that's it. If I have the IP of my computer though, not of my router, should it work as it is? Because I used a msgbox to display winsock1.localip and it gave me an ip not of my router, so I think that's it, but it still doesnt work with other people. I can now connect to myself though, using that ip, not 127.0.0.1

Pino
Jan 20th, 2005, 04:49 AM
ok i'll go to the website. So if I get a game like counter-strike (which i am actually thinking of) I'm not going to be able to host a game cuz my router... I can't think that there isn't a solution... are you telling me all those big online games, like half the people can't play them correctly?

[EDIT] I went to the site, and it said absolutely nothing about port forwarding. So what is that really?

[edit] I don't think that's it. If I have the IP of my computer though, not of my router, should it work as it is? Because I used a msgbox to display winsock1.localip and it gave me an ip not of my router, so I think that's it, but it still doesnt work with other people. I can now connect to myself though, using that ip, not 127.0.0.1

No they can play them correctly, if they get there router set up to forward all data on a certain port to a certain Pc 'behind' the router on the network,

Port forwarding is dependant on the router itself gimme a second and i'll get a link,

edit cant find the link, I'll get somone to confirm what i have said

Nafto
Jan 20th, 2005, 03:42 PM
but this port forwarding, is it done through the program? if so then is there a code for each router? it would seem to me like there would be a general code to do this and then it will either work or not work with your router.

Pino
Jan 20th, 2005, 05:26 PM
but this port forwarding, is it done through the program? if so then is there a code for each router? it would seem to me like there would be a general code to do this and then it will either work or not work with your router.

You can do port forwarding with code, but you would have to install it on the router (I think) which is near to impossible

when a connection connects to the ip(router) the router doesnt know what to do with it and there is nothing listening on the router you need a way to pass the data to the correct port on the correct PC

Nafto
Jan 20th, 2005, 08:09 PM
Ok. Lets start over and make it simple. So how do I get my client to connect to the server running on my computer if I have a router. Specifically how do I do whatever it is that I need to do, knowing what it is doesn't help me if I can't do it.

Pino
Jan 21st, 2005, 05:30 PM
Ok. Lets start over and make it simple. So how do I get my client to connect to the server running on my computer if I have a router. Specifically how do I do whatever it is that I need to do, knowing what it is doesn't help me if I can't do it.

Ok basicly if your running a server on your PC behind a router you need to set up the port forwarding, if your router doesnt support this then I dont think there is anything else you can do,

I've just spoke to someone about this and they say Port forawrding is the only way to run a server, Most routers do support it, could you post your Model Number\Name and i'll try and find some infomation for you

Hope it helps

visualAd
Jan 23rd, 2005, 06:44 AM
Your router allows many computers to connect to the Internet through the same IP address. It achieves this by modifying the packets and changing their address accordingly before sending them out on the Internet. Your router will employ some kind of port forwarding otherwise two way communication between the Internet and PC's inside your netowrk will be impossible.

If your router has a configurable firewall which allows you to control incoming connections then you will most probably be able to set it up to allow incoming connections to a specficied port to be sent to a particular server on your local network. Failing this it may let you enter the IP address of a DMZ server. If you change this to the IP address of your server then all incoming connections will be sent to that PC. If you do this then you must make sure you have a firewall running on it.

Best thing to do like already said is to post your router model. Port forwarding may also be referred to as the following by the manufacturer.


NAT
Firewall (imcoming)

dglienna
Jan 25th, 2005, 01:47 AM
Don't use DMZ unless you absolutely have to. The machine will be exposed to the Internet, which is almost unheard-of nowadays. Most routers have advanced settings that allow you to do port forwarding, which is all you need.