Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0e1bd16f3 | ||
|
|
de596fad8c | ||
|
|
e617b11f86 | ||
|
|
efecd40ab4 | ||
|
|
3604e5469e | ||
|
|
0548fee0a4 | ||
|
|
96ac335267 |
@@ -6,7 +6,6 @@
|
||||
package ChatProgramm;
|
||||
|
||||
import ChatProgramm.controller.CommandController;
|
||||
import ChatProgramm.model.Transmitter;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.UIManager;
|
||||
@@ -19,9 +18,7 @@ public class Start
|
||||
{
|
||||
public Start()
|
||||
{
|
||||
//Transmitter transmitter = new Transmitter();
|
||||
ChatView view = new ChatView();
|
||||
//CommandController controller_commands = new CommandController(view, transmitter);
|
||||
CommandController controller_commands = new CommandController(view);
|
||||
controller_commands.registerEvents();
|
||||
controller_commands.registerCommands();
|
||||
|
||||
@@ -8,7 +8,6 @@ package ChatProgramm.controller;
|
||||
import ChatProgramm.controller.commands.CommandConnect;
|
||||
import ChatProgramm.controller.commands.CommandInvoker;
|
||||
import ChatProgramm.controller.commands.CommandSend;
|
||||
import ChatProgramm.model.Transmitter;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -21,15 +20,8 @@ import java.awt.event.ActionListener;
|
||||
public class CommandController implements ActionListener{
|
||||
|
||||
private ChatView view;
|
||||
//private Transmitter transmitter;
|
||||
private CommandInvoker invoker;
|
||||
|
||||
// public CommandController(ChatView view, Transmitter transmitter){
|
||||
// this.view = view;
|
||||
// this.transmitter = transmitter;
|
||||
// this.invoker = new CommandInvoker();
|
||||
// }
|
||||
|
||||
|
||||
public CommandController(ChatView view){
|
||||
this.view = view;
|
||||
this.invoker = new CommandInvoker();
|
||||
@@ -41,8 +33,9 @@ public class CommandController implements ActionListener{
|
||||
}
|
||||
|
||||
public void registerCommands(){
|
||||
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view));
|
||||
invoker.addCommand(view.getTfNachricht(), new CommandSend());
|
||||
CommandSend commandSend = new CommandSend(view);
|
||||
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view, commandSend));
|
||||
invoker.addCommand(view.getTfNachricht(), commandSend);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
package ChatProgramm.controller;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
class Nachricht
|
||||
{
|
||||
public Nachricht()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
package ChatProgramm.controller;
|
||||
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.Flow.Subscriber;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public class ReceiveAdapter implements Subscriber<Nachricht>
|
||||
{
|
||||
public ReceiveAdapter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Flow.Subscription subscription)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Nachricht item)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import ChatProgramm.model.Server;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JRadioButton;
|
||||
@@ -25,12 +24,18 @@ public class CommandConnect implements CommandInterface
|
||||
private JRadioButton rBtnClient;
|
||||
private JDialog dialogFenster;
|
||||
private static Logger lg = OhmLogger.getLogger();
|
||||
private CommandSend commandSend;
|
||||
private ChatView view;
|
||||
|
||||
public CommandConnect(ChatView view)
|
||||
public CommandConnect(ChatView view, CommandInterface value)
|
||||
{
|
||||
rBtnServer = view.getBtnServer();
|
||||
rBtnClient = view.getBtnClient();
|
||||
dialogFenster = view.getjDialog1();
|
||||
|
||||
commandSend = (CommandSend) value;
|
||||
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +44,7 @@ public class CommandConnect implements CommandInterface
|
||||
if(rBtnServer.isSelected()){
|
||||
lg.info("Server ausgewählt");
|
||||
try {
|
||||
new Server();
|
||||
commandSend.transmitterInterface = new Server(view);
|
||||
} catch (IOException ex) {
|
||||
lg.info("Die Verbindung zum Server ist Fehlgeschlagen");
|
||||
}
|
||||
@@ -48,7 +53,7 @@ public class CommandConnect implements CommandInterface
|
||||
if(rBtnClient.isSelected()){
|
||||
lg.info("Client ausgewählt");
|
||||
try {
|
||||
new Client();
|
||||
commandSend.transmitterInterface = new Client(view);
|
||||
} catch (IOException ex) {
|
||||
lg.info("Die Verbindung zum Client ist Fehlgeschlagen");
|
||||
|
||||
@@ -68,4 +73,4 @@ public class CommandConnect implements CommandInterface
|
||||
public void undo()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,5 @@ public interface CommandInterface
|
||||
{
|
||||
public void execute();
|
||||
public void undo();
|
||||
// public void redo();
|
||||
public boolean isUndoable();
|
||||
}
|
||||
|
||||
@@ -5,22 +5,49 @@
|
||||
|
||||
package ChatProgramm.controller.commands;
|
||||
|
||||
import ChatProgramm.model.Client;
|
||||
import ChatProgramm.model.Server;
|
||||
import ChatProgramm.model.TransmitterInterface;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JTextField;
|
||||
import ChatProgramm.model.Nachricht;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public class CommandSend implements CommandInterface
|
||||
{
|
||||
public CommandSend()
|
||||
{
|
||||
private static Logger lg = OhmLogger.getLogger();
|
||||
private JTextField eingabeFeld;
|
||||
private String nachricht;
|
||||
private ChatView view;
|
||||
public TransmitterInterface transmitterInterface;
|
||||
public Server server;
|
||||
public Client client;
|
||||
|
||||
|
||||
|
||||
|
||||
public CommandSend(ChatView view)
|
||||
{
|
||||
this.view = view;
|
||||
this.eingabeFeld = view.getTfNachricht();
|
||||
transmitterInterface = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
if(transmitterInterface != null && !eingabeFeld.getText().isEmpty()){
|
||||
transmitterInterface.send(eingabeFeld.getText());
|
||||
eingabeFeld.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUndoable()
|
||||
{
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import ChatProgramm.view.ChatView;
|
||||
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.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.logging.*;
|
||||
|
||||
@@ -23,41 +17,16 @@ import java.util.logging.*;
|
||||
public class Client extends Transmitter {
|
||||
|
||||
private static Logger lg = Logger.getLogger("netz");
|
||||
|
||||
private Socket socket;
|
||||
private BufferedReader reader;
|
||||
private PrintWriter writer;
|
||||
|
||||
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();
|
||||
|
||||
// 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();
|
||||
initIO();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new Client();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connect() throws IOException {
|
||||
@@ -65,20 +34,6 @@ public class Client extends Transmitter {
|
||||
lg.info("Client: Verbindung wird aufgebaut");
|
||||
socket = new Socket(IP, PORT);
|
||||
lg.info("Client: Verbindung aufgebaut");
|
||||
|
||||
lg.info("Client: initialisiere reader und writer");
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
|
||||
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
||||
OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8");
|
||||
|
||||
reader = new BufferedReader(isr);
|
||||
writer = new PrintWriter(osr);
|
||||
lg.info("Client: Initialisierung abgeschlossen");
|
||||
|
||||
lg.info("Client: warte auf Nachricht");
|
||||
|
||||
} catch (java.io.InterruptedIOException e) {
|
||||
lg.warning("Timeout" + "(" + timeout / 1000 + "s)");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
package ChatProgramm.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public class Nachricht
|
||||
{
|
||||
private String nachricht;
|
||||
|
||||
public Nachricht(String nachricht)
|
||||
{
|
||||
this.nachricht = nachricht;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nachricht
|
||||
*/
|
||||
public String getNachricht() {
|
||||
return nachricht;
|
||||
}
|
||||
|
||||
public void setNachricht(String nachricht) {
|
||||
this.nachricht = nachricht;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.view.ChatView;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.Flow.Subscriber;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public class ReceiveAdapter implements Subscriber<Nachricht> {
|
||||
|
||||
private ChatView view;
|
||||
private Flow.Subscription subscription;
|
||||
|
||||
public ReceiveAdapter(ChatView view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Flow.Subscription subscription) {
|
||||
this.subscription = subscription;
|
||||
this.subscription.request(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Nachricht item) {
|
||||
|
||||
view.getTxtChat().append(item.getNachricht());
|
||||
this.subscription.request(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete(){
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,9 @@
|
||||
|
||||
package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.model.Transmitter;
|
||||
import java.io.BufferedReader;
|
||||
import ChatProgramm.view.ChatView;
|
||||
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.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.logging.*;
|
||||
|
||||
/**
|
||||
@@ -23,14 +16,10 @@ import java.util.logging.*;
|
||||
*/
|
||||
public class Server extends Transmitter
|
||||
{
|
||||
private static Logger lg = Logger.getLogger("netz");
|
||||
|
||||
private Socket socket;
|
||||
private BufferedReader reader;
|
||||
private PrintWriter writer;
|
||||
|
||||
private static Logger lg = Logger.getLogger("netz");
|
||||
private static final int PORT = 35000; //lt. iana port > 2¹⁵
|
||||
|
||||
|
||||
public void connect() throws IOException
|
||||
{
|
||||
try
|
||||
@@ -40,57 +29,17 @@ public class Server extends Transmitter
|
||||
lg.info("Server: warte auf Verbindung");
|
||||
socket = sSocket.accept();
|
||||
lg.info("Server: Verbindung akzeptiert");
|
||||
|
||||
lg.info("Server: initialisiere reader und writer");
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
|
||||
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
||||
OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8");
|
||||
|
||||
reader = new BufferedReader(isr);
|
||||
writer = new PrintWriter(osr);
|
||||
lg.info("Server: Initialisierung abgeschlossen");
|
||||
|
||||
lg.info("Server: warte auf Nachricht");
|
||||
|
||||
}
|
||||
catch ( java.io.InterruptedIOException e )
|
||||
{
|
||||
lg.warning("Timeout"+"("+timeout/1000+"s)");
|
||||
}
|
||||
|
||||
}
|
||||
public Server() throws IOException
|
||||
{
|
||||
connect();
|
||||
|
||||
// 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 Server(ChatView view) throws IOException {
|
||||
super(view);
|
||||
connect();
|
||||
initIO();
|
||||
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
new Server();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.view.ChatView;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -12,10 +13,12 @@ import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.Flow.Subscriber;
|
||||
import java.util.concurrent.SubmissionPublisher;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -23,49 +26,112 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public abstract class Transmitter implements Runnable, Subscriber<String> {
|
||||
public abstract class Transmitter implements Runnable, Subscriber<String>, TransmitterInterface {
|
||||
|
||||
static final int timeout = 60000;
|
||||
private static final int PORT = 35000;
|
||||
|
||||
private static Logger lg = Logger.getLogger("netz");
|
||||
|
||||
private Socket socket;
|
||||
private BufferedReader reader;
|
||||
private PrintWriter writer;
|
||||
|
||||
public Transmitter() {
|
||||
|
||||
protected Socket socket;
|
||||
protected BufferedReader reader;
|
||||
protected PrintWriter writer;
|
||||
|
||||
private Nachricht nachricht;
|
||||
private String txtNachricht;
|
||||
private boolean laufend;
|
||||
private SubmissionPublisher<Nachricht> textPublisher;
|
||||
private ExecutorService eService;
|
||||
private String receivedString;
|
||||
private ChatView view;
|
||||
private ReceiveAdapter receiveAdapter;
|
||||
|
||||
public Transmitter(ChatView view)
|
||||
{
|
||||
socket = new Socket();
|
||||
eService = null;
|
||||
receiveAdapter = new ReceiveAdapter(view);
|
||||
textPublisher = new SubmissionPublisher<>();
|
||||
this.view = view;
|
||||
addWertSubscription(receiveAdapter);
|
||||
nachricht = new Nachricht("");
|
||||
}
|
||||
|
||||
public void addWertSubscription(Subscriber<Nachricht> subscriber)
|
||||
{
|
||||
textPublisher.subscribe(subscriber);
|
||||
}
|
||||
|
||||
public abstract void connect() throws IOException;
|
||||
|
||||
public void initIO() {
|
||||
try {
|
||||
lg.info("Initialisiere reader und writer");
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
try {
|
||||
lg.info("Initialisiere reader und writer");
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
|
||||
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
||||
OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8");
|
||||
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
||||
OutputStreamWriter osr = new OutputStreamWriter(os, "UTF-8");
|
||||
|
||||
reader = new BufferedReader(isr);
|
||||
writer = new PrintWriter(osr);
|
||||
lg.info("Server: Initialisierung abgeschlossen");
|
||||
reader = new BufferedReader(isr);
|
||||
writer = new PrintWriter(osr);
|
||||
lg.info("Reader / Writer Initialisierung abgeschlossen");
|
||||
startempfangen();
|
||||
lg.info("Warte auf Nachricht");
|
||||
|
||||
lg.info("Server: warte auf Nachricht");
|
||||
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void send(String txtNachricht){
|
||||
|
||||
writer.println(txtNachricht);
|
||||
writer.flush();
|
||||
lg.info("Nachricht gesendet");
|
||||
nachricht.setNachricht("\nDu: " + txtNachricht);
|
||||
textPublisher.submit(nachricht);
|
||||
}
|
||||
public Nachricht receive(){
|
||||
try {
|
||||
txtNachricht = reader.readLine();
|
||||
if(!txtNachricht.isEmpty()){
|
||||
lg.info("Nachricht erhalten");
|
||||
nachricht.setNachricht("\nEr / Sie: " + txtNachricht);
|
||||
return nachricht;
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return nachricht;
|
||||
}
|
||||
|
||||
// public void disconnect (){
|
||||
// in.close();
|
||||
// out.close();
|
||||
// s.close();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
lg.info("Warte auf Nachricht");
|
||||
if(laufend) {
|
||||
nachricht = receive();
|
||||
if(!nachricht.getNachricht().isEmpty()){
|
||||
textPublisher.submit(nachricht);
|
||||
}
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Flow.Subscription subscription) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||
@@ -86,4 +152,15 @@ public abstract class Transmitter implements Runnable, Subscriber<String> {
|
||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||
}
|
||||
|
||||
private void startempfangen()
|
||||
{
|
||||
synchronized (this){
|
||||
laufend = true;
|
||||
}
|
||||
if (eService == null){
|
||||
eService = Executors.newSingleThreadExecutor();
|
||||
eService.execute(this);
|
||||
}
|
||||
lg.info("Starte Chat");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.model.Nachricht;
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public interface TransmitterInterface
|
||||
{
|
||||
public void send(String txtNachricht);
|
||||
public Nachricht receive();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user