feud.clientserver
Class SimpleClient.Sender

java.lang.Object
  extended byfeud.clientserver.SimpleClient.Sender
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
SimpleClient

private class SimpleClient.Sender
extends java.lang.Object
implements java.lang.Runnable

The working thread for a client. In this thread, data is being sent and received to/from the server.


Field Summary
private  java.net.Socket conn
           
private  boolean disconnect
           
private  java.io.InputStream is
           
private  java.io.OutputStream os
           
 
Constructor Summary
SimpleClient.Sender()
          Connects to the server with the configured address/port.
 
Method Summary
private  void connect()
          Connects to the server
private  void disconnect()
          Disconnects the client from the server.
private  void disconnectInternal()
          Tries to disconnect from the server.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conn

private java.net.Socket conn

is

private java.io.InputStream is

os

private java.io.OutputStream os

disconnect

private boolean disconnect
Constructor Detail

SimpleClient.Sender

public SimpleClient.Sender()
                    throws java.lang.Exception
Connects to the server with the configured address/port.

Throws:
java.lang.Exception - if the connection fails, the client thread fails...
Method Detail

disconnect

private void disconnect()
Disconnects the client from the server. This is done sending a logout request to the server and then terminating the thread. If the server gets the request, it can't vote against it, i.e. the client will be disconnected in every case.


disconnectInternal

private void disconnectInternal()
Tries to disconnect from the server. If this isn't possible, this is not an error. Maybe it has already been done before or the server is dead...


connect

private void connect()
              throws java.lang.Exception
Connects to the server

Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable