?
Solved

Chat program wont work through my router (NAT)

Posted on 2003-02-28
11
Medium Priority
?
355 Views
Last Modified: 2010-04-04
OK, i am building a direct chat program (use ip to connect) and i cant get it to work on my comp, most likely because of my router and NAT.

I am using TClientSocket, and TServerSocket.  I can connect to myself (127.0.0.1), but when someone trys to connect to me it gets an asynchronous socket error or something like that and it wont  connect, but i can connect to them.  I have an assigned ip address by my router 192.168.2.34, then a WAN IP from the DSL, i have tried the external ip but it just wont work.  Is there any way to get around this, shouild i use a different component, or what??  Bah, i just want it to work.
0
Comment
Question by:Joshjje
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 3

Expert Comment

by:loop_until
ID: 8045842
Well, does your router block the port you used for your chat program? Most routers only forward common ports (80, 21, 25 and so). You might want to check your router's configuration to make sure it is okay.

The others will have to connect using your external address (other than 192.168.x.x).

The problem does not come from the component (at the first sight) nor your program. If it works with your localhost (127.0.0.1) we might be able to make it worked with other people.

If you need more help, please provide port used, router's brand, firewall...


Hope it helps.
Have a nice day! :)
0
 

Author Comment

by:Joshjje
ID: 8046136
I have a Belkin 4-port switch dsl/cable router.  I want to know if there is a way to have it work without having to configure the router to accept the ports, etc.
0
 
LVL 3

Expert Comment

by:loop_until
ID: 8046570
Well, if you make your program talk over a common port, that could do. It is not necessarily recommended but you might want to check if that's your problem. Use port 80 or something like that and you'll be set.

Port 80 is the port used for http protocol (web browsing). It means it will use this "channel" to communicate. If you are browsing here it means your router let it pass ;-).

Anyhow, tell me if it works.
See ya! :-)


0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Joshjje
ID: 8047699
Hmm i tried port 80, it still works connecting to 127.0.0.1, but still doesnt work connecting to my external ip address, however, it doesnt give the asynchronous socket error thing as it did before, it just says connecting really fast then disconnects.  Ill see if my friend can connect to my external ip but if i cant he probably cant.
0
 

Expert Comment

by:Erdrick
ID: 8048872
1. Connect to http://192.168.2.34
2. Authenticate
3. go into port forwarding
4. choose a port range that reflects
   what you choose to be the port for
   your TServerSocketcomponent.
Port forwarding should look something similar to this:
       _____ ~ _____   ____________

Lets say you specified 6125 as your server port num, and the computer that will be running the program your made is 192.168.2.37

(note: this ip is what you will find if you go into dos  and type ipconfig /all on the computer that will be running your program, and is not to be confused with 127.0.0.1 which is each computers loop back address)  

your configuration for port forwarding would look like this:
       6125 ~ 6125   192.168.2.37

this would tell the router that all incoming connections to your real ip (external ip) would be sent through the router and come to 192.168.2.37, which would be your computer that is acting as the server.


I wrote a chat client awhile back and had the same problem with the asynchronous socket error message, this was caused when you have a port specified in your TServerSocket component that is already opened by another program on your system.  If this did not solve your questions or if you have any other questions lemme know.
0
 

Author Comment

by:Joshjje
ID: 8049579
Alright, you gonna have to explain how to code this one.  How do you authenticate and go into port forwarding?  Right now all i do is set the remotehost, port, etc., then do TClientSocket.Open;  I dont see anywhere about authenticating or port forwarding.  I havent done much with these components as you can tell.  Maybe you can send me your source for the chat program you made, or just explain it here, thanks.
0
 

Expert Comment

by:Erdrick
ID: 8049896
lol, i'm sorry... I didn't explain well enough I guess.  That stuff doesn't have to do with your actually coding, you actually point your webbrowser there and you should be able to change your routers settings.  As far as I know your code is probably all correct as long as your port is the same as the one your forward in the router configuration.  First, just try going to http://192.168.2.34 and see what occurs.

if you have aim my screen name is Erdrick444 msg me if you want me to walk u through it.
0
 

Expert Comment

by:Erdrick
ID: 8049909
lol, i'm sorry... I didn't explain well enough I guess.  That stuff doesn't have to do with your actually coding, you actually point your webbrowser there and you should be able to change your routers settings.  As far as I know your code is probably all correct as long as your port is the same as the one your forward in the router configuration.  First, just try going to http://192.168.2.34 and see what occurs.

if you have aim my screen name is Erdrick444 msg me if you want me to walk u through it.
0
 

Author Comment

by:Joshjje
ID: 8049950
Yeah, i can configure my router so that it will work, but i was wondering if there is some way to get around this without having to configure the router, but i guess there isnt
0
 

Accepted Solution

by:
Erdrick earned 150 total points
ID: 8050368
You can configure your computer to be a router if you have 2 network cards, or just directly connect your computer to the internet wan.  Other than that your going to have to tell the router where people who connect to it need to be sent, which is what it does when you forward data ports.
0
 

Author Comment

by:Joshjje
ID: 8050802
Yeah, well i dont see any way around this so ill just give you the points and call it good, thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question