Jump to content
  • Advertisement
Sign in to follow this  
JinJo

connecting to server, on another machine (still not fixed)

This topic is 4231 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am writing a sample app in java to get used to the networking and client/server stuff. It is a chat app Now I run my server on my pc, and i ran the client here too and it connected, no surprise as i used local host. Now i sent the client to a few friends to help me test but i dont know how they can connect to my pc's server. I am using eclipse and ran the server as a program inside eclipse. It seems that I just need to get the client to connect the socket to my ip and the port my server is on? I dont know how to get my ip, i done ipconfig and went to a website, i got my local one 127.blah and i got this other one off a site 82.blah So would i tell the client to connect to the 82 one? i tried this and never worked on port 80, 7654, 1123 etc. could someone help please? thanks [Edited by - JinJo on November 16, 2006 6:27:30 AM]

Share this post


Link to post
Share on other sites
Advertisement
You need to get your IP from a site like this and then have your friend connect to you with that IP address at the port that your server's using.

[edit]
If that doesn't work that means that you are behind a firewall or NAT which doesn't accept any incoming connections. If you have an firewall consider disabling that and when that won't work you have to talk with administrator of your LAN so that he'll forward the port your are using for you. (Provided you are on some kind of *Local* Area Network - with big ISP corporations this is not possible.)
[/edit]

HTH.

Share this post


Link to post
Share on other sites
If you have a firewall you also need to open the ports; if you have a router you need to enable port forwarding.

Share this post


Link to post
Share on other sites
So I used Kiputs tool to get my correct ip address. I am using that, couldnt connect on any port (though I can still start the server on most ports)

I am behind a router and set it up to unlock certain ports, tried both tcp and udp, even though im only using tcp.

I still cant get it to connect, I got a program that inspects the ports. I have a few open on my localhost but it doesnt seem to show any open on the router.

This is irritating, though I can still continue my development on the local pc just now, i want to be able to test on network multiplayer.

Any more advice?

Share this post


Link to post
Share on other sites
You may have a bit of reading to do about network basics. If it isnt worth your time learning, then you could just use something like Hamachi to create a VPN. Better that than turning off firewalls willy nilly.

Share this post


Link to post
Share on other sites
Ok, here's an overview of your network topology:

your PC <-> router <-> internet <-> client

- Your PC has an IP (not 'localhost'=127.0.0.1 !!, enter 'ipconfig' in your dos console to get your IP, something like i.e. 192.168.0.1) which is only known to your router.
- Your 'router' has an IP (assigned by your ISP, not really your router, but to keep it simple lets say your router has an IP) which is only known to the internet.

1. If YOU try to connect to your program, running client and server on the same PC, you need to use 'localhost' = 127.0.0.1, you can't use the IP of your router or your PC to do this.
2. If your friend tries to connect to your PC, he will only be able to 'see' your router. So he needs to connect to your routers IP.
3. But your router is not running your program, so it needs to forward the connection to your PC. To do this you have to open the according port in your router and forward incoming connections on this port to your PC. In this case you need to enter your PC IP (i.e. 192.168.0.1) in your port-forwarding configuration of your router.
4. Pitfall: most ISPs assign dynamic IPs to your 'router', in this case, whenever your reconnect to the internet you will get an other IP. So, before your friend tries to connect to you, check your routers internet IP.

--
Ashaman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!