Class ClientNetworkThread

java.lang.Object
  extended byClientNetworkThread
All Implemented Interfaces:
java.lang.Runnable

public class ClientNetworkThread
extends java.lang.Object
implements java.lang.Runnable

Works in a producer consumer relationship to the grpical processing Thread. This means that when graphical processing is finished and one waits for network input this Thread is woken, and parses the following network message before releaving control to graphic processing and sleeps indefineltely. Created by IntelliJ IDEA. User: ofsdahl Date: 10.jan.2007 : 15:29:56 To change this template use File | Settings | File Templates.


Field Summary
protected  boolean alive
           
protected  java.io.InputStream is
           
protected  LeGaMidlet lega
           
protected  java.lang.Thread networkThread
           
protected  java.io.OutputStream os
           
protected  int protocolState
           
 java.lang.String received
           
protected  SocketConnection sc
           
protected  boolean stringBuffered
           
 
Constructor Summary
ClientNetworkThread(LeGaMidlet lega)
          Initialize variables
 
Method Summary
 void close()
          Closes connections from the client side.
 java.lang.String receive()
          Strips the prtocol header and signal chars off the message.
 void run()
          Alternates between interpreting network input and sleeping.
 void send(java.lang.String str)
          Sends the provided String to the server.
 void wakeMe()
          Notify the object monitor that it is time to wake up and start processing network input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lega

protected LeGaMidlet lega

os

protected java.io.OutputStream os

is

protected java.io.InputStream is

sc

protected SocketConnection sc

protocolState

protected int protocolState

stringBuffered

protected boolean stringBuffered

received

public java.lang.String received

networkThread

protected java.lang.Thread networkThread

alive

protected boolean alive
Constructor Detail

ClientNetworkThread

public ClientNetworkThread(LeGaMidlet lega)
Initialize variables

Parameters:
lega - Midlet class
Method Detail

run

public void run()
Alternates between interpreting network input and sleeping. Loops forever.

Specified by:
run in interface java.lang.Runnable

wakeMe

public void wakeMe()
Notify the object monitor that it is time to wake up and start processing network input.


receive

public java.lang.String receive()
Strips the prtocol header and signal chars off the message.

Returns:

close

public void close()
           throws java.io.IOException
Closes connections from the client side.

Throws:
java.io.IOException

send

public void send(java.lang.String str)
Sends the provided String to the server.

Parameters:
str -