Browse Source

outdoor users(16)

Louis Farina 3 years ago
parent
commit
9d55a5700e
4 changed files with 7 additions and 6 deletions
  1. BIN
      Projet.jar
  2. 4
    2
      src/chat/NetworkClient.java
  3. 0
    1
      src/chat/OutdoorListenerThread.java
  4. 3
    3
      src/chat/ReceiveThread.java

BIN
Projet.jar View File


+ 4
- 2
src/chat/NetworkClient.java View File

@@ -203,21 +203,23 @@ public class NetworkClient {
203 203
 	
204 204
 	void send (Notification notif)
205 205
 	{
206
+		System.out.println("Indoor users:");
206 207
 		for(Socket s:dest_sockets)
207 208
 		{
208 209
 			try
209 210
 			{
210
-				//System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
211
+				System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
211 212
 				ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
212 213
 			    out.writeObject(notif);
213 214
 			}
214 215
 			catch(IOException e){}
215 216
 		}
217
+		System.out.println("Outdoor users:");
216 218
 		for(Socket s:outdoor_dest_sockets)
217 219
     	{
218 220
     		try
219 221
     		{
220
-    			//System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
222
+    			System.out.println(s.getInetAddress().getHostAddress() + ": local port " + s.getLocalPort() + ", remote port " + s.getPort());
221 223
     			ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
222 224
 			    out.writeObject(notif);
223 225
     		}

+ 0
- 1
src/chat/OutdoorListenerThread.java View File

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

+ 3
- 3
src/chat/ReceiveThread.java View File

@@ -47,7 +47,6 @@ class ReceiveThread extends Thread {
47 47
 			        
48 48
 			        if(!(notif.getAuthor().equals(user)) && !notif.isRedirected())
49 49
 	            	{
50
-	            		System.out.println("Redirecting message");
51 50
 	            		for(Socket s:outdoor_dest_sockets)
52 51
 				    	{
53 52
 				    		try
@@ -55,6 +54,7 @@ class ReceiveThread extends Thread {
55 54
 				    			ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
56 55
 				    			notif.setRedirected(true);
57 56
 				    		    out.writeObject(notif);
57
+				    		    notif.setRedirected(false);
58 58
 				    		}
59 59
 				    		catch(IOException e){}
60 60
 				    	}
@@ -141,10 +141,10 @@ class ReceiveThread extends Thread {
141 141
 		catch(EOFException e) {}
142 142
 		catch(SocketException e)
143 143
 		{
144
-            /*	if(!isOutdoor)
144
+            	if(!isOutdoor)
145 145
             	dest_sockets.remove(socket);
146 146
             	else
147
-            	outdoor_dest_sockets.remove(socket);*/
147
+            	outdoor_dest_sockets.remove(socket);
148 148
 		}
149 149
 		catch(Exception e)
150 150
     	{

Loading…
Cancel
Save