All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.fsp.FSPsession

java.lang.Object
   |
   +----net.fsp.FSPsession

public class FSPsession
extends Object
This class represents one live FSP session.

FSPsession class takes care about FSP session management. It handles packet resends on timeouts and key management.

See Also:
FSPpacket

Variable Index

 o DEFAULT_DELAY
default resend delay
 o DEFAULT_TIMEOUT
default timeout (msec)
 o MAX_DELAY
maximum resend delay.
 o MIN_DELAY
minimum resend delay

Constructor Index

 o FSPsession(InetAddress, int)
Creates a new FSP session
 o FSPsession(String, int)
Creates a new FSP session

Method Index

 o close()
close a session.
 o finalize()
closes session before doing GC.
 o getDelay()
gets the delay.
 o getMaxDelay()
gets the maximum delay between packets.
 o getTimeout()
get timeout value.
 o interact(byte, long, byte[], int, int, byte[], int, int)
Sends FSP packet and waits for reply, resend packet if needed
 o setDelay(int)
sets the delay.
 o setMaxDelay(int)
sets the maximum delay between packets.
 o setTimeout(int)
set timeout value.

Variables

 o MIN_DELAY
 public static final int MIN_DELAY
minimum resend delay

 o DEFAULT_DELAY
 public static final int DEFAULT_DELAY
default resend delay

 o MAX_DELAY
 public static final int MAX_DELAY
maximum resend delay. FSP protocol has max delay 300s, we are using 60s for faster recovery on common Internet/Wifi lines

 o DEFAULT_TIMEOUT
 public static final int DEFAULT_TIMEOUT
default timeout (msec)

Constructors

 o FSPsession
 public FSPsession(String host,
                   int port) throws SocketException, UnknownHostException
Creates a new FSP session

Parameters:
host - hostname of fsp server
port - port number on fsp server
 o FSPsession
 public FSPsession(InetAddress host,
                   int port) throws SocketException
Creates a new FSP session

Parameters:
host - address of fsp server
port - port number on fsp server

Methods

 o interact
 public FSPpacket interact(byte cmd,
                           long filepos,
                           byte data1[],
                           int offset1,
                           int length1,
                           byte data2[],
                           int offset2,
                           int length2) throws InterruptedIOException
Sends FSP packet and waits for reply, resend packet if needed

 o close
 public void close()
close a session.

Session object can't be used after session is closed. This also sends CC_BYE command to server.

 o getDelay
 public int getDelay()
gets the delay.

 o setDelay
 public void setDelay(int ndelay)
sets the delay.

This functions sets delay parameter of FSP protocol stack. This is timeout value for first packet. If packet is lost delay is multiplied by 1.5. Delay is in milliseconds and must be between MIN_DELAY and MAX_DELAY

Parameters:
ndelay - new delay in milliseconds
 o getMaxDelay
 public int getMaxDelay()
gets the maximum delay between packets.

 o setMaxDelay
 public void setMaxDelay(int newdelay)
sets the maximum delay between packets.

Parameters:
newdelay - new max delay time in milliseconds.
 o getTimeout
 public int getTimeout()
get timeout value.

 o setTimeout
 public void setTimeout(int ntimeout)
set timeout value.

If no packet from server is received in this time, session times out.

Parameters:
timeout - timeout value in milliseconds
 o finalize
 public void finalize()
closes session before doing GC.

If session is not closed, close it before doing GC on this object. Timeout is set to 7 sec when doing it.

Overrides:
finalize in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index