ajout des outdoor users(2)
This commit is contained in:
parent
1348dc96ed
commit
40b5c02a7d
1 changed files with 5 additions and 24 deletions
|
@ -14,28 +14,6 @@ import java.util.*;
|
|||
import chat.User;
|
||||
import chat.Message;
|
||||
|
||||
/*class OutdoorUserListenerThread extends Thread {
|
||||
OutdoorUserListenerThread()
|
||||
{
|
||||
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
byte[] buffer = new byte[100];
|
||||
DatagramPacket request = new DatagramPacket(buffer, buffer.length);
|
||||
DatagramSocket requestSocket;
|
||||
try
|
||||
{
|
||||
requestSocket = new DatagramSocket(1233);
|
||||
requestSocket.receive(request)
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
class ReceiveThread extends Thread {
|
||||
User user;
|
||||
Socket socket;
|
||||
|
@ -153,7 +131,7 @@ class ConnectionListenerThread extends Thread {
|
|||
user = in_user;
|
||||
known_users = in_known_users;
|
||||
dest_sockets = in_dest_sockets;
|
||||
outdoor_dest_sockets = in_dest_sockets;
|
||||
outdoor_dest_sockets = in_outdoor_dest_sockets;
|
||||
displayArea = in_displayArea;
|
||||
knownUsersPanel = in_knownUsersPanel;
|
||||
portNumber = in_portNumber;
|
||||
|
@ -446,7 +424,7 @@ public class NetworkClient {
|
|||
{
|
||||
try
|
||||
{
|
||||
Socket s = new Socket("0.0.0.0", portNumber);
|
||||
Socket s = new Socket(destinationIP, portNumber);
|
||||
dest_sockets.add(s);
|
||||
}
|
||||
catch(IOException e)
|
||||
|
@ -475,6 +453,8 @@ public class NetworkClient {
|
|||
|
||||
void send (String message)
|
||||
{
|
||||
System.out.println("Sending message");
|
||||
System.out.println("Indoor users:");
|
||||
for(Socket s:dest_sockets)
|
||||
{
|
||||
try
|
||||
|
@ -485,6 +465,7 @@ public class NetworkClient {
|
|||
}
|
||||
catch(IOException e){}
|
||||
}
|
||||
System.out.println("Outdoor users:");
|
||||
for(Socket s:outdoor_dest_sockets)
|
||||
{
|
||||
try
|
||||
|
|
Loading…
Reference in a new issue