outdoor users(16)

This commit is contained in:
Louis Farina 2021-02-15 15:20:11 +01:00
parent b03bb2a335
commit 9d55a5700e
4 changed files with 7 additions and 6 deletions

Binary file not shown.

View file

@ -203,21 +203,23 @@ public class NetworkClient {
void send (Notification notif)
{
System.out.println("Indoor users:");
for(Socket s:dest_sockets)
{
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());
out.writeObject(notif);
}
catch(IOException e){}
}
System.out.println("Outdoor users:");
for(Socket s:outdoor_dest_sockets)
{
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());
out.writeObject(notif);
}

View file

@ -43,7 +43,6 @@ OutdoorListenerThread(User in_user, List<User> in_known_users, List<User> in_kn
String username;
String response = "";
try
{
while(!exit)

View file

@ -47,7 +47,6 @@ class ReceiveThread extends Thread {
if(!(notif.getAuthor().equals(user)) && !notif.isRedirected())
{
System.out.println("Redirecting message");
for(Socket s:outdoor_dest_sockets)
{
try
@ -55,6 +54,7 @@ class ReceiveThread extends Thread {
ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
notif.setRedirected(true);
out.writeObject(notif);
notif.setRedirected(false);
}
catch(IOException e){}
}
@ -141,10 +141,10 @@ class ReceiveThread extends Thread {
catch(EOFException e) {}
catch(SocketException e)
{
/* if(!isOutdoor)
if(!isOutdoor)
dest_sockets.remove(socket);
else
outdoor_dest_sockets.remove(socket);*/
outdoor_dest_sockets.remove(socket);
}
catch(Exception e)
{