| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package server;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.net.Socket;
- public class NetworkUser {
- private String name;
- private Socket client;
- private InputStream input;
- private OutputStream output;
-
- public NetworkUser(String username, Socket client){
- this.name = username;
- this.client = client;
- try {
- input = client.getInputStream();
- output = client.getOutputStream();
- } catch (IOException e) {
- System.err.println("Somethings nasty happends with a user");
- }
- }
- /* GETTERS AND SETTERS */
-
- /**
- * @return the name of the user
- */
- public String getName() {
- return name;
- }
-
- public boolean checkConnection(){
- try {
- output.write(0);
- } catch (IOException e) {
- return false;
- }
- return true;
- }
- }
|