*
The moose likes Sockets and Internet Protocols and the fly likes Socket & NAT technologie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Socket & NAT technologie" Watch "Socket & NAT technologie" New topic
Author

Socket & NAT technologie

ouadie lahdioui
Greenhorn

Joined: Feb 23, 2012
Posts: 1

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 ?



Ouadie
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

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
Sheriff

Joined: Sep 28, 2004
Posts: 18488
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Socket & NAT technologie
 
Similar Threads
PA #1.....picture association
america wasn't always like this
UDP SOCKET
Download file from FTP using java client
SocketException