Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket & NAT technologie

 
ouadie lahdioui
Greenhorn
Posts: 1
C++ Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi EveryOne ,
I need to create a programme based on JAVA Socket , thts normal !
but my client connected behind a router , i mean tht is use NAT Technologie to connect to Internet .
can somme one Help me ?

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Java program doesn't know or care about the NAT. You write your code exactly the same way as if there was no NAT.
 
Henry Wong
author
Marshal
Pie
Posts: 21514
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ouadie lahdioui wrote:Hi EveryOne ,
I need to create a programme based on JAVA Socket , thts normal !
but my client connected behind a router , i mean tht is use NAT Technologie to connect to Internet .
can somme one Help me ?



Please search for previous topics -- as this question has come up before.

Basically, if your client (who is behind the router) is the socket initiator, you should have no problems. However, if the client is the socket acceptor, then (1) you need your server to connect to the router instead of the client machine, and (2) you need to configure the router to forward the particular port to the client machine.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic