Free
Class Comms

java.lang.Object
  |
  +--Free.Comms

public class Comms
extends java.lang.Object

Comms is the key class for launching communications with servers. The class launches a thread for TCP/IP communications and also contains the methods for building packets. These packets are then held in message for retrieval by TCPClient

Version:
0.11 2 April 2001
Author:
Jason Kitcat

Field Summary
protected static java.lang.String ER_address
          constant to hold address of electoral roll server
protected static int freePort
          constant to store value being used as FREE port number for security reasons I recommend this is changed regularly
protected static java.lang.String T_address
          constant to hold address of totaller server
protected  int tdCount
          keeps track of where we are in the Vector
protected  java.util.Vector threadVect
          Vector to store threads
protected  TimeOutThread timer
           
protected  java.util.Vector totalData
          stores total packet data while waiting to be sent
 
Constructor Summary
protected Comms()
           
 
Method Summary
protected  java.util.Date getCheck()
           
protected  java.lang.String getCheckKey()
           
protected  java.lang.String getMessage()
           
protected  void getTotalVoted()
          getTotalVoted communicates with the ERServer to find out how many people voted.
protected  char getType()
           
protected  void newCheck()
           
protected  void noCheck()
           
protected  void sendDiag(java.lang.String msg)
          sendDiag dispatches any diagnostic packets for debugging.
protected  void sendKey(java.lang.String akey)
          sendKey delivers a key to an ERServer for confirming someone has voted.
protected  void sendTotals()
          sendTotals creates check date for security, calculates vote counts and sends on to the Totaller server.
protected  void setCheckKey(java.lang.String x)
           
protected  void setFromServer(java.lang.String x)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timer

protected TimeOutThread timer

T_address

protected static final java.lang.String T_address
constant to hold address of totaller server

ER_address

protected static final java.lang.String ER_address
constant to hold address of electoral roll server

freePort

protected static final int freePort
constant to store value being used as FREE port number for security reasons I recommend this is changed regularly

totalData

protected java.util.Vector totalData
stores total packet data while waiting to be sent

tdCount

protected int tdCount
keeps track of where we are in the Vector

threadVect

protected java.util.Vector threadVect
Vector to store threads
Constructor Detail

Comms

protected Comms()
Method Detail

setFromServer

protected void setFromServer(java.lang.String x)

getCheckKey

protected java.lang.String getCheckKey()

setCheckKey

protected void setCheckKey(java.lang.String x)

getCheck

protected java.util.Date getCheck()

noCheck

protected void noCheck()

newCheck

protected void newCheck()

getMessage

protected java.lang.String getMessage()

getType

protected char getType()

sendTotals

protected void sendTotals()
sendTotals creates check date for security, calculates vote counts and sends on to the Totaller server.

sendKey

protected void sendKey(java.lang.String akey)
                throws java.lang.Exception
sendKey delivers a key to an ERServer for confirming someone has voted.
Parameters:
akey - The key to send

getTotalVoted

protected void getTotalVoted()
getTotalVoted communicates with the ERServer to find out how many people voted. This can be compared with the number of votes registered to give an idea of validity.

sendDiag

protected void sendDiag(java.lang.String msg)
sendDiag dispatches any diagnostic packets for debugging.
Parameters:
msg - Data for packet