Server
Class ServerListener

public class ServerListener
implements java.lang.Runnable

Title:

Description:

Copyright: Copyright (c) 2004

Company:

Version:
1.0
Author:
not attributable
Constructor Detail

ServerListener

public ServerListener(java.net.Socket aSocket,
                      Server.ServerProtocol aServerProtocol)
Creates an instance of the Listener Thread
Parameters:
aPeer - Peer

Method Detail

run

public void run()
Running The Listener Thread

listenCycle

public void listenCycle()
Listens and takes appropriate action for the incoming messages

readBitField

public void readBitField(java.io.DataInputStream in,
                         int length_field)
Reads the incoming bitField message from the peer
Parameters:
in - DataInputStream
length_field - int
Returns:
int[]

readHave

public void readHave(java.io.DataInputStream in,
                     int length_field)
Read the have Message Peer has sent telling what additional pieces it Got Set that Particular Bit in the BitField of the Peer
Parameters:
in - DataInputStream
length_field - int
Throws:
Exception -

readRequest

public void readRequest(java.io.DataInputStream in,
                        int length_field)
Reads an incoming request message for a piece from the Peer
Parameters:
in - DataInputStream
length_field - int
Throws:
Exception -

readCancel

public void readCancel(java.io.DataInputStream in,
                       int length_field)
Reads a cancel Request message from the Peer
Parameters:
in - DataInputStream
length_field - int
Throws:
Exception -