|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--SSF.OS.ProtocolSession
|
+--SSF.OS.TCP.test.tcpClient
A simple prototype class for creating TCP client-server sessions for one or more file transfers (virtual data bytes). Obtains DML configuration specifying available servers and session parameters, chooses server(s) randomly from the list specified in the .Net.traffic DML attribute. The client-server protocol is absolutely minimal: the client sends to server one integer that specifies the total amount of virtual data bytes it requests.
| Nested Class Summary | |
class |
tcpClient.serverData
inner class specifying a server by its IP address and port number |
| Field Summary | |
boolean |
debug
option to print out debug information (from DML) |
int |
file_size
constant requested file size (from DML) |
protected RandomDistribution |
fileSizeDistr
Distribution of random file sizes |
Host |
localHost
Host entity where this pseudo-protocol is installed |
int |
localIP
Host's IP address |
java.lang.String |
localNHI
Host's NHI address |
double |
offTime
constant off-time between file requests. |
protected RandomDistribution |
offTimeDistr
Distribution of random off-times |
boolean |
recover
option to recover from a connection error (from DML) |
int |
request_size
size (in bytes) of request segment sent from client to server (from DML) |
RandomStream |
rng
random number generator given to this tcpClient |
java.lang.String |
serverList
Name of the server list |
java.util.Vector |
serverVector
Servers known to this host |
int |
sessNumber
session number |
boolean |
show_report
option to print out summary session report (from DML) |
double |
sleepTime
sleep time (in seconds) between invocations of startOnOff() |
socketMaster |
sockms
Host's Socket ProtocolSession |
long |
start_time
default start time after init() from DML |
long |
start_window
default start time window from DML |
| Fields inherited from class SSF.OS.ProtocolSession |
name, use |
| Constructor Summary | |
tcpClient()
Constructors |
|
| Method Summary | |
void |
clientDebug(java.lang.String str)
preamble to client diagnostics |
void |
config(com.renesys.raceway.DML.Configuration cfg)
Configure the client instance parameters. |
void |
configTraffic(com.renesys.raceway.DML.Configuration traffic,
java.lang.String client_nhi,
java.util.Vector server_list)
Add a list of servers available to the client(s) to the server_list. |
java.lang.Object |
getRandomVectorElement(java.util.Vector v,
RandomStream rng)
|
void |
init()
Kick-off timer to start client operation, user should comment out either the startOnce or startOnOff mode for desired behavior. |
boolean |
push(ProtocolMessage message,
ProtocolSession fromSession)
Does nothing |
void |
startOnOff()
A simple file transfer renewal process: open a session to a randomly selected server, proceed until session is completed either with success or failure; then wait for a specified time; and repeat. |
| Methods inherited from class SSF.OS.ProtocolSession |
close, closed, debugIdentifier, inGraph, open, opened, pushAfterDelay, pushAfterDelayFailed, setGraph, version |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public boolean debug
public boolean show_report
public long start_time
public long start_window
public RandomStream rng
public int request_size
public int file_size
public boolean recover
protected RandomDistribution fileSizeDistr
public double offTime
protected RandomDistribution offTimeDistr
public Host localHost
public int localIP
public java.lang.String localNHI
public socketMaster sockms
public java.lang.String serverList
public java.util.Vector serverVector
public int sessNumber
public double sleepTime
| Constructor Detail |
public tcpClient()
| Method Detail |
public void init()
throws ProtocolException
init in class ProtocolSessionProtocolExceptionpublic void startOnOff()
public java.lang.Object getRandomVectorElement(java.util.Vector v,
RandomStream rng)
public void config(com.renesys.raceway.DML.Configuration cfg)
throws com.renesys.raceway.DML.configException
ProtocolSession [ name client use SSF.OS.TCP.test.tcpClient
start_time 5.0 # earliest time of sending request to server, in seconds
start_window 1.5 # sends request to server at randomly chosen time
# in interval [start_time, start_time+start_window]
# file_size 1000 # requested file size (number of virtual bytes, int)
# is commented out because random_file_size is set
# in this example, see below.
request_size 4 # nominal size of client request datagram (bytes, int)
# (must be the same for the server)
show_report true # print client-server session summary report, true/false
debug true # print verbose client diagnostics, true/false
# new atributes in ssfnet_1.3 - backward compatible with ssfnet_1.2
------------------------------------------------------------------
server_list "mylist" # identifies server list(s) name in traffic pattern
# if omitted concatenate all server lists in
# matching pattern
# only one of either "file_size" or "random_file_size" must be used.
# It is an error to specify both "file_size" or "random_file_size"
# simultaneously.
# Generated random variate interpreted as number of payload bytes,
# truncated to the integer value > 1.
random_file_size [
distribution [
# distribution-dependent parameters are here.
# see SSF.Util.Random.RandomStream for 21 distinct distributions
name "Exponential" # distribution class name
lambda 0.001 # mean = 1/lambda
]
]
# if both "off_time" and "random_off_time" are omitted,
# client requests a file only once.
# It is an error to specify both "off_time" and "random_off_time"
# simultaneously.
# An off_time (fixed or random) specifies client sleep time (seconds)
# between completion of a file transfer request and the next request.
# off_time 10.0 # commented out because random_off_time
# is specified
random_off_time [
distribution [
name "Exponential" # distribution class name
lambda 0.01 # mean = 1/lambda
# distribution-dependent params here...
]
]
# If connection request times out or a connection is dropped
# due to any error msg (peer reset, TCP abort, no route found, etc)
# then the client may send a file request again as follows:
# i) if "error_recovery" is omitted or "false", client suspends
# operation indefinitely (backward compatible with ssfnet1.2)
# ii) if "error_recovery true", then:
# - if both "off_time" and "random_off_time" are omitted,
# client suspends operation indefinitely
# - if either "off_time" or "random_off_time" are specified,
# client will try connecting to the same server after
# a delay equal to the next value of "off_time".
error_recovery true
]
config in interface com.renesys.raceway.DML.Configurableconfig in class ProtocolSessioncom.renesys.raceway.DML.configException
public void configTraffic(com.renesys.raceway.DML.Configuration traffic,
java.lang.String client_nhi,
java.util.Vector server_list)
throws com.renesys.raceway.DML.configException
All NHI addresses must be global.
A given client_nhi matches the value of the attribute "client foo' iff the NHI string "client_nhi" extends the NHI value "foo", viz. client_nhi = foo:* or client_nhi = foo. The attribute traffic can have the forms
traffic [
pattern [
client 1:1 # value N or N:H allowed, where N is NHI network prefix
servers [list "caseA" nhi 1:2(0) port 10] # single server
]
pattern [
client 2:1
servers [list "caseB" nhi_range [from 2:2(0) to 2:5(0)] port 11] # vector of servers
]
]
In case of a range of nhi addreses, an allowed range is of the form
from N:h1(i) to N:h2(i), where N is a valid Net prefix,
and h1 <= h2 is a range of hosts.
The optional attribute servers.list introduced in ssfnet_1.3
can be matched by tcpClient or httpClient attribute server_list
to narrow down a list of servers, and - more importantly - to allow
a client application to distinguish multiple servers on a single host (Note
that tcpClient and httpClient configuration does not specify the server port
number; instead a client searches the list of all servers in the
.Net.traffic attribute, and chooses the ones that match the client's
host NHI address and - if present - also match the server_list
string.
In the future a generalization of this method should be executed by SSF.Net.Net to avoid repetition of the same work by all tcpClients.
com.renesys.raceway.DML.configException
public boolean push(ProtocolMessage message,
ProtocolSession fromSession)
throws ProtocolException
push in class ProtocolSessionProtocolExceptionpublic void clientDebug(java.lang.String str)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||