Skip to main content
gamedev.net
🔒 Locked

[java] Chat Room with Sockets

Started by samoz Aug 30, 2006 at 11:29 AM 4 replies 1.2k views
Original Post
samoz
samoz
Hey guys, I had a question about making a chat room with sockets. Last year in school I wrote one (purely for learning purposes ;)), but it only works on my schools network . . . My question is, how would I set one up to work so that I could use it over the internet? Let me clarify, I already have the whole chat room system, logins, admin commands, everything is handled, I just need to know how to get network addresses or w/e I need to get computers hooked up over the internet that aren't on a LAN like my class was.
Palidine
Palidine
You need to have a server with a publically adressable IP address to act as intermediary between the clients. The problem you run into over the internet is firewalls and people behind a NAT (typically a router); they aren't publicaly adressable I believe what you do is have everyone connect to a central server, and that server mediates the packet exchange.

-me
samoz
samoz
So i need to post my server on a computer not behind a router then, so I can get its IP address?

Is there any way to get my IP address, then use the sub-address that the router gives so that I can still host from behind my router?
phaelax
phaelax
Set up port-forwarding on your router. Anything incoming to your IP over the specified port will be forwarded to the computer you choose. It might also be called a "Virtual Server" on your router settings. Mine's listed under NAT.
NightMonkey
NightMonkey
Hi,
I am also trying to create an online chatroom using an applet that is hosted on a free Geocities site and a java console application on my home PC to act as a server for the applet. I have managed to get this running on a local area network but doesn’t work on the web because the applet can’t connect to the IP of the server. Is there any way I can create a publicly accessible IP on my home PC? or does anyone have any networking guides on this subject?
Alrecenk
Alrecenk
If you are using an applet then it can only connect back to the same server that it is hosted from. If you host an applet on geocities then geocities has to host the server for it, and if you want to host the server then the applet has to run off of a webserver on your computer. It's a security thing. You could either try hosting your own webserver and putting your applet on it(that's what I do) or not using an applet(seems to be the preferred method) or I think getting the applet signed will allow you to work around that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.