TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sean McHugh
NA
13
0
How do you deal with NAT when creating network applications?
Sep 9 2009 10:34 AM
I can create programs that talk to each other as long as they are running on computers in the same subnetwork. But I can't get them to work on the internet, of course, using private IP addresses. So I have done a few hours of googling and I understand this whole problem a little bit better but I still need some help. Let me explain the problem as best I can. I am on a private network with a private IP address. When I send and receive info across the internet my computers private IP addresses is translated (NAT) by my router to a public IP address. This is done because of the limited number of IP addresses in the world, because it makes configuring networks easier, and I think it has something to do with UPNP (I'm not sure). I found the following code on codeproject.com: string myIP = "an ap address"; IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(myIP), 8000); Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); server.Connect(ipep); if I use 127.0.0.1 or if I get the private IP address of the computer running the server application and use that as the IP address for the client application to connect to (client running on different computer which uses same wireless router as the server application's computer) then it will work. But let's say that I wanted you to be able to run my program on your computer. If I look up my public IP address and set myIP = "my public ip" will that work? I can tell you that it does not work if I do that on another computer connected to the internet by this router. It's pretty obvious that I am confused. I thought this would be a pretty common thing but I'm having a lot of trouble finding good information about it.
Reply
Answers (
1
)
convert HTML table into PDF file using c#.net
Retrieving file names from directory