Bonjour a tous

J'ai écrit un petit chat en Java qui fonctionne correctement, le seul problème est qu'il ne marche qu'en local, avec l'adresse IP fournit par mon modem/routeur, et j'aimerais qu'il fonctionne aussi sur Internet. Le problème c'est que je ne vois pas du tout comment faire...

Est ce que quelqu'un a une idée ?

Voici les codes de mon serveur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import java.net.*;
import java.io.*;
import java.util.*;
 
public class Serveur extends Thread
{
	static ArrayList<Client> sesClients = new ArrayList<Client>();
 
	Client sonClient;
	String sonPseudo;
 
	public Serveur(Client telClient)
	{
		sonClient = telClient;
	}
 
	public static void etablirConnexion(int telPort)
	{
		try
		{
			ServerSocket laSocketServeur = new ServerSocket(telPort);
 
			System.out.println("Connexion serveur : " + laSocketServeur);
 
			Client leClient = new Client(laSocketServeur.accept());
 
			ajouterClient(leClient);
 
			(new Serveur(leClient)).start();
 
			while(true)
			{
				leClient = new Client(laSocketServeur.accept());
 
				ajouterClient(leClient);
 
				(new Serveur(leClient)).start();
			}
		}
		catch(IOException telleException)
		{
			System.out.println("Erreur du serveur");
		}
	}
 
	private static void ajouterClient(Client telClient)
	{
		sesClients.add(telClient);
	}
 
	public void run()
	{
		try
		{
			sonPseudo = sonClient.getEntree().readLine();
 
			System.out.println(sonClient.getIP() + " vient de se connecter sous le pseudo : " + sonPseudo);
 
			while(true)
			{
				String laPhrase = sonClient.getEntree().readLine();
 
				System.out.println(sonPseudo + " (" + sonClient.getIP() + ")" + " envoi le message : " + laPhrase);
 
				for(int i = 0; i < sesClients.size(); i++)
				{
					sesClients.get(i).getSortie().println(sonPseudo + " : " + laPhrase);
				}
			}
		}
		catch(IOException telleException)
		{
			System.out.println(sonPseudo + " (" + sonClient.getIP() + ")" + " s'est deconnecte");
		}
 
	}
 
	public static void main(String[] telsArgs)
	{
		Serveur.etablirConnexion(8080);
	}
}
et de mon Client :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.io.*;
 
public class PanelChat extends JPanel implements ActionListener, Runnable
{
	JTextArea sonChampDialogue;
	JTextField sonChampSaisie;
	JButton sonBoutonEnvoyer;
 
	Client sonClient;
 
	public PanelChat(String telPseudo, String telleIP, int telPort) throws UnknownHostException, IOException
	{
		super(new GridBagLayout());
 
		GridBagConstraints lesContraintes = new GridBagConstraints();
		lesContraintes.fill = GridBagConstraints.BOTH;
		lesContraintes.insets = new Insets(5, 5, 5, 5);
		lesContraintes.gridx = 0;
		lesContraintes.gridy = 0;
		lesContraintes.gridwidth = 2;
		lesContraintes.gridheight = 1;
		lesContraintes.weightx = 2;
		lesContraintes.weighty = 2;
 
		sonChampDialogue = new JTextArea();
		sonChampDialogue.setLineWrap(true);
		sonChampDialogue.setWrapStyleWord(true);
 
		JScrollPane leScrollPane = new JScrollPane(sonChampDialogue);
		leScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
 
		add(leScrollPane, lesContraintes);
 
		lesContraintes.gridy = 1;
		lesContraintes.gridwidth = 1;
		lesContraintes.weightx = 2;
		lesContraintes.weighty = 0;
 
		sonChampSaisie = new JTextField(1);
		sonChampSaisie.addKeyListener(new GestionnaireClavier());
 
		add(sonChampSaisie, lesContraintes);
 
		lesContraintes.gridx = 1;
		lesContraintes.weightx = 0;
 
		sonBoutonEnvoyer = new JButton("Envoyer");
		sonBoutonEnvoyer.addActionListener(this);
		add(sonBoutonEnvoyer, lesContraintes);
 
		sonClient = new Client(new Socket(telleIP, telPort));
		sonClient.getSortie().println(telPseudo);
 
		(new Thread(this)).start();
	}
 
	public void ajouterLigne(String telleLigne)
	{
		sonChampDialogue.append(telleLigne + "\n");
	}
 
	public String getLigne()
	{
		if(!sonChampSaisie.getText().equals(""))
		{
			return sonChampSaisie.getText();
		}
		else return "";
	}
 
	public void envoyerLigne()
	{
		String laLigne = getLigne();
 
		if(!laLigne.equals(""))
		{
			 sonClient.getSortie().println(laLigne);
			 sonChampSaisie.setText("");
		}
	}
 
	public void run()
	{
		try
		{
			while(true)
			{
				ajouterLigne(sonClient.getEntree().readLine());
			}
		}
		catch(IOException telleException)
		{
			JOptionPane.showMessageDialog(getTopLevelAncestor(), telleException.toString());
		}
	}
 
	public void actionPerformed(ActionEvent telEvent)
	{
		envoyerLigne();
	}
 
	private class GestionnaireClavier extends KeyAdapter
	{
		public void keyPressed(KeyEvent telEvent)
		{
			if(telEvent.getKeyCode() == KeyEvent.VK_ENTER) envoyerLigne();
		}
	}
}
D'avance, merci !