outdoor users(16)
This commit is contained in:
parent
b03bb2a335
commit
9d55a5700e
4 changed files with 7 additions and 6 deletions
BIN
Projet.jar
BIN
Projet.jar
Binary file not shown.
|
@ -203,21 +203,23 @@ public class NetworkClient {
|
||||||
|
|
||||||
void send (Notification notif)
|
void send (Notification notif)
|
||||||
{
|
{
|
||||||
|
System.out.println("Indoor users:");
|
||||||
for(Socket s:dest_sockets)
|
for(Socket s:dest_sockets)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
|
System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
|
||||||
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
|
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
|
||||||
out.writeObject(notif);
|
out.writeObject(notif);
|
||||||
}
|
}
|
||||||
catch(IOException e){}
|
catch(IOException e){}
|
||||||
}
|
}
|
||||||
|
System.out.println("Outdoor users:");
|
||||||
for(Socket s:outdoor_dest_sockets)
|
for(Socket s:outdoor_dest_sockets)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
|
System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
|
||||||
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
|
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
|
||||||
out.writeObject(notif);
|
out.writeObject(notif);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ OutdoorListenerThread(User in_user, List<User> in_known_users, List<User> in_kn
|
||||||
String username;
|
String username;
|
||||||
String response = "";
|
String response = "";
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while(!exit)
|
while(!exit)
|
||||||
|
|
|
@ -47,7 +47,6 @@ class ReceiveThread extends Thread {
|
||||||
|
|
||||||
if(!(notif.getAuthor().equals(user)) && !notif.isRedirected())
|
if(!(notif.getAuthor().equals(user)) && !notif.isRedirected())
|
||||||
{
|
{
|
||||||
System.out.println("Redirecting message");
|
|
||||||
for(Socket s:outdoor_dest_sockets)
|
for(Socket s:outdoor_dest_sockets)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -55,6 +54,7 @@ class ReceiveThread extends Thread {
|
||||||
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
|
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
|
||||||
notif.setRedirected(true);
|
notif.setRedirected(true);
|
||||||
out.writeObject(notif);
|
out.writeObject(notif);
|
||||||
|
notif.setRedirected(false);
|
||||||
}
|
}
|
||||||
catch(IOException e){}
|
catch(IOException e){}
|
||||||
}
|
}
|
||||||
|
@ -141,10 +141,10 @@ class ReceiveThread extends Thread {
|
||||||
catch(EOFException e) {}
|
catch(EOFException e) {}
|
||||||
catch(SocketException e)
|
catch(SocketException e)
|
||||||
{
|
{
|
||||||
/* if(!isOutdoor)
|
if(!isOutdoor)
|
||||||
dest_sockets.remove(socket);
|
dest_sockets.remove(socket);
|
||||||
else
|
else
|
||||||
outdoor_dest_sockets.remove(socket);*/
|
outdoor_dest_sockets.remove(socket);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue