Click here to Skip to main content
15,567,466 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
See more:
I created an application that has a chat room. I want to my users use a private chat like Y! messenger. When i create my chatroom server, to listen at my port i had to add that port in my router(My adsl adaptor works as a router). So how i can make a private chat for users who have a router like me?

Am i require to receive message from client in server and pass to another client or i can connect client P2P and clients send private messages directly?
Updated 3-Dec-09 2:50am

1 solution

I think you need to go read up on how networks work :)

The thing you need to remember is that when a computer connects DIRECTLY to the internet it has 2 IP addresses. A private network address(like or and a public network IP address.

Your case is probably different. I suspect your router is acting as a gateway, this means that your router connects to the internet and then shares that internet connection with other PC's on your private network. There is still a public and private IP address, but your chat clients can't access your server application directly.

If this is the case you'll have to set up NAT or Port Forwarding on the router itself. What this does is if a client connects to a specific port(which ever port your sever is set to listen to) all those requests are forwarded to your machine to handle.

This is alot to take in if you don't understand the basics of networking. I suggest you go Google public and private networks, gateway, and port forwarding.

Hope this helps
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900