|
|
@@ -6,6 +6,7 @@ package ChatProgramm.model; |
|
|
|
|
|
|
|
import ChatProgramm.controller.Nachricht; |
|
|
|
import ChatProgramm.controller.ReceiveAdapter; |
|
|
|
import ChatProgramm.util.OhmLogger; |
|
|
|
import ChatProgramm.view.ChatView; |
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
@@ -15,7 +16,6 @@ import java.io.InputStreamReader; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
import java.io.PrintWriter; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.Socket; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
@@ -35,7 +35,7 @@ public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, Tr |
|
|
|
protected static final int PORT = 35000; |
|
|
|
protected static final String IP = "127.0.0.1"; |
|
|
|
|
|
|
|
private static Logger lg = Logger.getLogger("netz"); |
|
|
|
private static Logger lg = OhmLogger.getLogger(); |
|
|
|
|
|
|
|
protected Socket socket; |
|
|
|
protected BufferedReader reader; |
|
|
@@ -104,11 +104,10 @@ public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, Tr |
|
|
|
writer.flush(); |
|
|
|
|
|
|
|
lg.info("Nachricht wird angezeigt"); |
|
|
|
lg.info(nachricht.getNachricht()); |
|
|
|
textPublisher.submit(nachricht); |
|
|
|
} |
|
|
|
|
|
|
|
public Nachricht recieve(){ |
|
|
|
public Nachricht receive(){ |
|
|
|
Nachricht nachricht = new Nachricht(""); |
|
|
|
try { |
|
|
|
String txtNachricht = reader.readLine(); |
|
|
@@ -130,9 +129,9 @@ public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, Tr |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
while (true) { |
|
|
|
lg.info("running"); |
|
|
|
lg.info("Warte auf Nachricht"); |
|
|
|
if(laufend) { |
|
|
|
Nachricht eingehendeNachricht = recieve(); |
|
|
|
Nachricht eingehendeNachricht = receive(); |
|
|
|
|
|
|
|
if(!eingehendeNachricht.getNachricht().isEmpty()){ |
|
|
|
textPublisher.submit(eingehendeNachricht); |