WIP8 système de connection à plusieurs utilisateurs
This commit is contained in:
parent
b518621a88
commit
6904cf452e
8 changed files with 2 additions and 6 deletions
Binary file not shown.
|
@ -2,7 +2,6 @@ package chat;
|
||||||
|
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -256,8 +255,7 @@ public class ClientWindow implements ActionListener {
|
||||||
{
|
{
|
||||||
for(int i = 0;i < userList.size();i ++)
|
for(int i = 0;i < userList.size();i ++)
|
||||||
{
|
{
|
||||||
System.out.println("Name:" + userList.get(i));
|
System.out.println(hostList.get(i));
|
||||||
System.out.println("Address:" + hostList.get(i));
|
|
||||||
user.add_to_known_users(userList.get(i), hostList.get(i));
|
user.add_to_known_users(userList.get(i), hostList.get(i));
|
||||||
}
|
}
|
||||||
user.add_to_known_users(username, InetAddress.getLocalHost().getHostAddress());
|
user.add_to_known_users(username, InetAddress.getLocalHost().getHostAddress());
|
||||||
|
@ -267,7 +265,6 @@ public class ClientWindow implements ActionListener {
|
||||||
catch(SocketTimeoutException e)
|
catch(SocketTimeoutException e)
|
||||||
{
|
{
|
||||||
user.add_to_known_users(username, getLocalIP());
|
user.add_to_known_users(username, getLocalIP());
|
||||||
System.out.println(getLocalIP());
|
|
||||||
System.out.println("Reply timed out");
|
System.out.println("Reply timed out");
|
||||||
connected = true;
|
connected = true;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +328,6 @@ public class ClientWindow implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
String message = messageField.getText();
|
String message = messageField.getText();
|
||||||
messageField.setText("");
|
messageField.setText("");
|
||||||
chatText.append(user.getpseudo() + " : " + message + "\n");
|
|
||||||
|
|
||||||
for(String address:user.getHosts())
|
for(String address:user.getHosts())
|
||||||
{
|
{
|
||||||
|
|
BIN
src/chat/ConnectionListenerThread.class
Normal file
BIN
src/chat/ConnectionListenerThread.class
Normal file
Binary file not shown.
BIN
src/chat/Message.class
Normal file
BIN
src/chat/Message.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/chat/User.class
Normal file
BIN
src/chat/User.class
Normal file
Binary file not shown.
|
@ -9,7 +9,7 @@ public class User {
|
||||||
private ArrayList<String> knownUsers;
|
private ArrayList<String> knownUsers;
|
||||||
private ArrayList<String> knownHosts;
|
private ArrayList<String> knownHosts;
|
||||||
|
|
||||||
User(String in_pseudo)
|
public User(String in_pseudo)
|
||||||
{
|
{
|
||||||
pseudo = in_pseudo;
|
pseudo = in_pseudo;
|
||||||
knownUsers = new ArrayList<String>();
|
knownUsers = new ArrayList<String>();
|
||||||
|
|
Loading…
Reference in a new issue