Compare commits
2
Commits
Jens
..
0548fee0a4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0548fee0a4 | ||
|
|
96ac335267 |
No files matched your search
@@ -41,9 +41,8 @@ public class CommandController implements ActionListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerCommands(){
|
public void registerCommands(){
|
||||||
CommandSend commandSend = new CommandSend(view);
|
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view));
|
||||||
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view, commandSend));
|
invoker.addCommand(view.getTfNachricht(), new CommandSend());
|
||||||
invoker.addCommand(view.getTfNachricht(), commandSend);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,19 +26,11 @@ public class CommandConnect implements CommandInterface
|
|||||||
private JDialog dialogFenster;
|
private JDialog dialogFenster;
|
||||||
private static Logger lg = OhmLogger.getLogger();
|
private static Logger lg = OhmLogger.getLogger();
|
||||||
|
|
||||||
private CommandSend commandSend;
|
public CommandConnect(ChatView view)
|
||||||
|
|
||||||
private ChatView view;
|
|
||||||
|
|
||||||
public CommandConnect(ChatView view, CommandInterface value)
|
|
||||||
{
|
{
|
||||||
rBtnServer = view.getBtnServer();
|
rBtnServer = view.getBtnServer();
|
||||||
rBtnClient = view.getBtnClient();
|
rBtnClient = view.getBtnClient();
|
||||||
dialogFenster = view.getjDialog1();
|
dialogFenster = view.getjDialog1();
|
||||||
|
|
||||||
commandSend = (CommandSend) value;
|
|
||||||
|
|
||||||
this.view = view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +39,7 @@ public class CommandConnect implements CommandInterface
|
|||||||
if(rBtnServer.isSelected()){
|
if(rBtnServer.isSelected()){
|
||||||
lg.info("Server ausgewählt");
|
lg.info("Server ausgewählt");
|
||||||
try {
|
try {
|
||||||
commandSend.transmitterInterface = new Server(view);
|
new Server();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
lg.info("Die Verbindung zum Server ist Fehlgeschlagen");
|
lg.info("Die Verbindung zum Server ist Fehlgeschlagen");
|
||||||
}
|
}
|
||||||
@@ -56,7 +48,7 @@ public class CommandConnect implements CommandInterface
|
|||||||
if(rBtnClient.isSelected()){
|
if(rBtnClient.isSelected()){
|
||||||
lg.info("Client ausgewählt");
|
lg.info("Client ausgewählt");
|
||||||
try {
|
try {
|
||||||
commandSend.transmitterInterface = new Client(view);
|
new Client();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
lg.info("Die Verbindung zum Client ist Fehlgeschlagen");
|
lg.info("Die Verbindung zum Client ist Fehlgeschlagen");
|
||||||
|
|
||||||
|
|||||||
@@ -5,47 +5,20 @@
|
|||||||
|
|
||||||
package ChatProgramm.controller.commands;
|
package ChatProgramm.controller.commands;
|
||||||
|
|
||||||
import ChatProgramm.controller.Nachricht;
|
|
||||||
import ChatProgramm.model.Client;
|
|
||||||
import ChatProgramm.model.Server;
|
|
||||||
import ChatProgramm.model.Transmitter;
|
|
||||||
import ChatProgramm.model.TransmitterInterface;
|
|
||||||
import ChatProgramm.util.OhmLogger;
|
|
||||||
import ChatProgramm.view.ChatView;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author ahren
|
* @author ahren
|
||||||
*/
|
*/
|
||||||
public class CommandSend implements CommandInterface
|
public class CommandSend implements CommandInterface
|
||||||
{
|
{
|
||||||
private static Logger lg = OhmLogger.getLogger();
|
public CommandSend()
|
||||||
|
|
||||||
private ChatView view;
|
|
||||||
public TransmitterInterface transmitterInterface;
|
|
||||||
private JTextField eingabeFeld;
|
|
||||||
|
|
||||||
public Server server;
|
|
||||||
public Client client;
|
|
||||||
|
|
||||||
public CommandSend(ChatView view)
|
|
||||||
{
|
{
|
||||||
this.view = view;
|
|
||||||
this.eingabeFeld = view.getTfNachricht();
|
|
||||||
transmitterInterface = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute()
|
public void execute()
|
||||||
{
|
{
|
||||||
if(transmitterInterface != null && !eingabeFeld.getText().isEmpty()){
|
|
||||||
transmitterInterface.send(new Nachricht(eingabeFeld.getText()));
|
|
||||||
eingabeFeld.setText("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package ChatProgramm.model;
|
package ChatProgramm.model;
|
||||||
|
|
||||||
import ChatProgramm.util.OhmLogger;
|
|
||||||
import ChatProgramm.view.ChatView;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
@@ -18,26 +15,12 @@ import java.util.logging.*;
|
|||||||
*/
|
*/
|
||||||
public class Client extends Transmitter {
|
public class Client extends Transmitter {
|
||||||
|
|
||||||
private static Logger lg = OhmLogger.getLogger();
|
private static Logger lg = Logger.getLogger("netz");
|
||||||
|
private static final int PORT = 35000; //lt. iana port > 2¹⁵
|
||||||
|
private static final String IP = "127.0.0.1";
|
||||||
|
|
||||||
|
public Client() throws IOException {
|
||||||
public Client(ChatView view) throws IOException {
|
|
||||||
super(view);
|
|
||||||
connect();
|
connect();
|
||||||
initIO();
|
|
||||||
|
|
||||||
// out.println("Hallo Du Server - ich bin ein Client");
|
|
||||||
// out.flush();
|
|
||||||
//
|
|
||||||
// lg.info("Client: warte auf Serverantwort");
|
|
||||||
//
|
|
||||||
// String nachricht = in.readLine(); // ACHTUNG blockiert
|
|
||||||
// lg.info("Client: Serverbestätigung erhalten");
|
|
||||||
//
|
|
||||||
// lg.info("Client: fertig");
|
|
||||||
// in.close();
|
|
||||||
// out.close();
|
|
||||||
// s.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -47,11 +30,10 @@ public class Client extends Transmitter {
|
|||||||
lg.info("Client: Verbindung wird aufgebaut");
|
lg.info("Client: Verbindung wird aufgebaut");
|
||||||
socket = new Socket(IP, PORT);
|
socket = new Socket(IP, PORT);
|
||||||
lg.info("Client: Verbindung aufgebaut");
|
lg.info("Client: Verbindung aufgebaut");
|
||||||
|
initIO();
|
||||||
|
lg.info("Client: warte auf Nachricht");
|
||||||
} catch (java.io.InterruptedIOException e) {
|
} catch (java.io.InterruptedIOException e) {
|
||||||
lg.warning("Timeout" + "(" + timeout / 1000 + "s)");
|
lg.warning("Timeout" + "(" + timeout / 1000 + "s)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,20 +3,20 @@
|
|||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ChatProgramm.controller;
|
package ChatProgramm.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author ahren
|
* @author ahren
|
||||||
*/
|
*/
|
||||||
public class Nachricht
|
class Nachricht
|
||||||
{
|
{
|
||||||
private String nachricht;
|
private String nachricht;
|
||||||
//private int id;
|
//private int id;
|
||||||
|
|
||||||
public Nachricht(String nachricht)
|
public Nachricht(String nachricht)
|
||||||
{
|
{
|
||||||
this.setNachricht(nachricht);
|
this.nachricht = nachricht;
|
||||||
//this.id = id;
|
//this.id = id;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,4 @@ public class Nachricht
|
|||||||
public String getNachricht() {
|
public String getNachricht() {
|
||||||
return nachricht;
|
return nachricht;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNachricht(String nachricht) {
|
|
||||||
this.nachricht = nachricht;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
*/
|
*/
|
||||||
package ChatProgramm.controller;
|
package ChatProgramm.model;
|
||||||
|
|
||||||
import ChatProgramm.view.ChatView;
|
import ChatProgramm.view.ChatView;
|
||||||
import java.util.concurrent.Flow;
|
import java.util.concurrent.Flow;
|
||||||
@@ -38,6 +38,6 @@ public class ReceiveAdapter implements Subscriber<Nachricht> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,73 +2,39 @@
|
|||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ChatProgramm.model;
|
package ChatProgramm.model;
|
||||||
|
|
||||||
import ChatProgramm.model.Transmitter;
|
|
||||||
import ChatProgramm.util.OhmLogger;
|
|
||||||
import ChatProgramm.view.ChatView;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.Flow;
|
|
||||||
import java.util.concurrent.SubmissionPublisher;
|
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder Class
|
* Builder Class
|
||||||
*
|
|
||||||
* @author le
|
* @author le
|
||||||
*/
|
*/
|
||||||
public class Server extends Transmitter {
|
public class Server extends Transmitter
|
||||||
|
{
|
||||||
private static Logger lg = OhmLogger.getLogger();
|
private static Logger lg = Logger.getLogger("netz");
|
||||||
|
private static final int PORT = 35000; //lt. iana port > 2¹⁵
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connect() throws IOException {
|
|
||||||
try {
|
|
||||||
ServerSocket sSocket = new ServerSocket(PORT);
|
|
||||||
sSocket.setSoTimeout(timeout);
|
|
||||||
lg.info("Server: warte auf Verbindung");
|
|
||||||
socket = sSocket.accept();
|
|
||||||
lg.info("Server: Verbindung akzeptiert");
|
|
||||||
|
|
||||||
} catch (java.io.InterruptedIOException e) {
|
|
||||||
lg.warning("Timeout" + "(" + timeout / 1000 + "s)");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Server(ChatView view) throws IOException {
|
|
||||||
super(view);
|
|
||||||
connect();
|
|
||||||
initIO();
|
|
||||||
|
|
||||||
// String nachricht = in.readLine(); // ACHTUNG blockiert
|
|
||||||
// lg.info("Server: Nachricht erhalten");
|
|
||||||
// System.out.println("Server: NACHRICHT = " + nachricht);
|
|
||||||
//
|
|
||||||
// // ACHTUNG: blockiert NICHT!!!!
|
|
||||||
// out.println("Server an Client: Nachricht erhalten");
|
|
||||||
// out.flush(); // wichtig
|
|
||||||
//
|
|
||||||
// lg.info("Server: fertig");
|
|
||||||
// in.close();
|
|
||||||
// out.close();
|
|
||||||
// s.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void connect() throws IOException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ServerSocket sSocket = new ServerSocket(PORT);
|
||||||
|
sSocket.setSoTimeout(timeout);
|
||||||
|
lg.info("Server: warte auf Verbindung");
|
||||||
|
socket = sSocket.accept();
|
||||||
|
lg.info("Server: Verbindung akzeptiert");
|
||||||
|
initIO();
|
||||||
|
}
|
||||||
|
catch ( java.io.InterruptedIOException e )
|
||||||
|
{
|
||||||
|
lg.warning("Timeout"+"("+timeout/1000+"s)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Server() throws IOException{
|
||||||
|
connect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package ChatProgramm.model;
|
package ChatProgramm.model;
|
||||||
|
|
||||||
import ChatProgramm.controller.Nachricht;
|
|
||||||
import ChatProgramm.controller.ReceiveAdapter;
|
|
||||||
import ChatProgramm.util.OhmLogger;
|
|
||||||
import ChatProgramm.view.ChatView;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -16,9 +11,9 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.Flow;
|
import java.util.concurrent.Flow;
|
||||||
import java.util.concurrent.Flow.Subscriber;
|
import java.util.concurrent.Flow.Subscriber;
|
||||||
import java.util.concurrent.SubmissionPublisher;
|
import java.util.concurrent.SubmissionPublisher;
|
||||||
@@ -29,42 +24,37 @@ import java.util.logging.Logger;
|
|||||||
*
|
*
|
||||||
* @author ahren
|
* @author ahren
|
||||||
*/
|
*/
|
||||||
public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, TransmitterInterface {
|
public abstract class Transmitter implements Runnable, Subscriber<String> {
|
||||||
|
|
||||||
static final int timeout = 30000;
|
static final int timeout = 60000;
|
||||||
protected static final int PORT = 35000;
|
private static final int PORT = 35000;
|
||||||
protected static final String IP = "127.0.0.1";
|
|
||||||
|
|
||||||
private static Logger lg = OhmLogger.getLogger();
|
private static Logger lg = Logger.getLogger("netz");
|
||||||
|
|
||||||
protected Socket socket;
|
protected Socket socket;
|
||||||
protected BufferedReader reader;
|
protected BufferedReader reader;
|
||||||
protected PrintWriter writer;
|
protected PrintWriter writer;
|
||||||
|
|
||||||
|
private Nachricht nachricht;
|
||||||
|
private boolean laufend;
|
||||||
|
private Thread receive;
|
||||||
private SubmissionPublisher<Nachricht> textPublisher;
|
private SubmissionPublisher<Nachricht> textPublisher;
|
||||||
private ExecutorService eService;
|
|
||||||
private boolean laufend = false;
|
|
||||||
|
|
||||||
private ChatView view;
|
public Transmitter()
|
||||||
|
{
|
||||||
|
nachricht = new Nachricht("");
|
||||||
|
laufend = false;
|
||||||
|
receive = null;
|
||||||
|
textPublisher = new SubmissionPublisher<>();
|
||||||
|
}
|
||||||
|
|
||||||
private ReceiveAdapter receiveAdapter;
|
public void addWertSubscription(Subscriber<Nachricht> subscriber)
|
||||||
|
{
|
||||||
public Transmitter(ChatView view) {
|
textPublisher.subscribe(subscriber);
|
||||||
socket = new Socket();
|
|
||||||
eService = null;
|
|
||||||
this.view = view;
|
|
||||||
textPublisher = new SubmissionPublisher<>();
|
|
||||||
|
|
||||||
receiveAdapter = new ReceiveAdapter(view);
|
|
||||||
addWertSubscription(receiveAdapter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void connect() throws IOException;
|
public abstract void connect() throws IOException;
|
||||||
|
|
||||||
public void addWertSubscription(Subscriber<Nachricht> subscriber) {
|
|
||||||
textPublisher.subscribe(subscriber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initIO() {
|
public void initIO() {
|
||||||
try {
|
try {
|
||||||
lg.info("Initialisiere reader und writer");
|
lg.info("Initialisiere reader und writer");
|
||||||
@@ -76,72 +66,52 @@ public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, Tr
|
|||||||
|
|
||||||
reader = new BufferedReader(isr);
|
reader = new BufferedReader(isr);
|
||||||
writer = new PrintWriter(osr);
|
writer = new PrintWriter(osr);
|
||||||
lg.info("Initialisierung abgeschlossen");
|
lg.info("Server: Initialisierung abgeschlossen");
|
||||||
|
startempfangen();
|
||||||
start();
|
lg.info("Server: warte auf Nachricht");
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(){
|
public void send(String string){
|
||||||
synchronized (this){
|
|
||||||
laufend = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eService == null){
|
writer.println(string);
|
||||||
eService = Executors.newSingleThreadExecutor();
|
|
||||||
eService.execute(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
lg.info("Starte Chat");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void send(Nachricht nachricht) {
|
|
||||||
lg.info("Nachricht wird gesendet");
|
|
||||||
writer.println(nachricht.getNachricht());
|
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
lg.info("Nachricht gesendet");
|
||||||
|
textPublisher.submit(new Nachricht(string));
|
||||||
|
//
|
||||||
|
// String nachricht = in.readLine(); // ACHTUNG blockiert
|
||||||
|
// lg.info("Client: Serverbestätigung erhalten");
|
||||||
|
//
|
||||||
|
// lg.info("Client: fertig");
|
||||||
|
// in.close();
|
||||||
|
// out.close();
|
||||||
|
// s.close();
|
||||||
|
|
||||||
lg.info("Nachricht wird angezeigt");
|
|
||||||
textPublisher.submit(nachricht);
|
// in.close();
|
||||||
|
// out.close();
|
||||||
|
// s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Nachricht receive(){
|
|
||||||
Nachricht nachricht = new Nachricht("");
|
|
||||||
try {
|
|
||||||
String txtNachricht = reader.readLine();
|
|
||||||
if(!txtNachricht.isEmpty()){
|
|
||||||
lg.info("Nachricht erhalten");
|
|
||||||
nachricht.setNachricht(txtNachricht);
|
|
||||||
return nachricht;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return nachricht;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (true) {
|
while(laufend){
|
||||||
lg.info("Warte auf Nachricht");
|
try
|
||||||
if(laufend) {
|
{
|
||||||
Nachricht eingehendeNachricht = receive();
|
String receivedString = reader.readLine(); // ACHTUNG blockiert
|
||||||
|
textPublisher.submit(new Nachricht(receivedString));
|
||||||
if(!eingehendeNachricht.getNachricht().isEmpty()){
|
|
||||||
textPublisher.submit(eingehendeNachricht);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
lg.info("Client: Serverbestätigung erhalten");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -149,6 +119,11 @@ public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, Tr
|
|||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String item) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable throwable) {
|
public void onError(Throwable throwable) {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
@@ -159,9 +134,15 @@ public abstract class Transmitter implements Runnable, Subscriber<Nachricht>, Tr
|
|||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void startempfangen()
|
||||||
public void onNext(Nachricht item) {
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
laufend = true;
|
||||||
|
if (receive == null)
|
||||||
|
{
|
||||||
|
receive = new Thread(this);
|
||||||
|
receive.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package ChatProgramm.model;
|
|
||||||
|
|
||||||
import ChatProgramm.controller.Nachricht;
|
|
||||||
|
|
||||||
public interface TransmitterInterface{
|
|
||||||
public void send(Nachricht nachricht);
|
|
||||||
public Nachricht receive();
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user