|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--SSF.OS.ProtocolSession
|
+--SSF.OS.UDP.test.udpStreamServer
A simple UDP streaming server application provided as an example. The server configures itself from the DML file that specifies the server's wellKnownPort, the maximum datagram_size ( = payload in bytes) and the send_interval (in seconds) between sending consecutive chunks of virtual data to the client.
The client-server protocol is absolutely minimal: the client sends to server's well known address just one integer that specifies the total amount of virtual data it requests. After receiving a client's request, the server spawns a slave server that periodically sends the datagrams of size datagram_size to the client until the request is fulfilled.
The default is no limit on the number of clients, unless the attribute client_limit is set.
There is no limit on the number of servers that can coexist in a single Host as long as each udpServer has a distinct wellKnownPort number.
If datagram_size is chosen to be larger than allowed by either the local UDP protocol (udpinit.send_buffer_size), or by the remote UDP receive buffer (udpinit.rcv_buffer_size), the datagrams will be dropped - with some diagnostic output if the debug options are set to true.
The datagram_size and send_interval should be chosen so that the resulting data bandwidth does not exceed the bitrate specified on the server's Host link interface, otherwise the interface will queue the outgoing datagrams and may drop them if configured with small enough buffer.
| Field Summary |
| Fields inherited from class SSF.OS.ProtocolSession |
name, use |
| Constructor Summary | |
udpStreamServer()
Constructors |
|
| Method Summary | |
void |
config(com.renesys.raceway.DML.Configuration cfg)
Server configuration. |
void |
init()
Initialization routine, called by the ProtocolGraph after instantiation. |
boolean |
push(ProtocolMessage message,
ProtocolSession fromSession)
Routine to call when a message is being sent to ("pushed into") this ProtocolSession by another ProtocolSession. |
void |
serv()
|
| 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 |
| Constructor Detail |
public udpStreamServer()
| Method Detail |
public void config(com.renesys.raceway.DML.Configuration cfg)
throws com.renesys.raceway.DML.configException
ProtocolSession [ name server use SSF.OS.UDP.test.udpStreamServer
port %I # server's well known port number
client_limit %I # max number of simultaneous clients,
# if omitted, no limit
request_size %I # client request nominal datagram size (bytes, int)
datagram_size %I # max server datagram payload size (virtual bytes, int)
send_interval %F # time interval between consecutive server datagrams, sec
# if omitted, datagrams are sent back to back
show_report %S # print client-server session summary report, true/false
debug %S # print verbose client/server diagnostics, true/false
]
config in interface com.renesys.raceway.DML.Configurableconfig in class ProtocolSessioncom.renesys.raceway.DML.configExceptionpublic void init()
ProtocolSession
init in class ProtocolSessionpublic void serv()
public boolean push(ProtocolMessage message,
ProtocolSession fromSession)
throws ProtocolException
ProtocolSessionIf you desire "safe" interaction with other CPU activities, even though your push() consumes no measurable/modelable CPU cycles, define the "cpudelay true" attribute for the ProtocolGraph and use pushAfterDelay(message,fromSession,0.0). This will guarantee proper ordering; that is, the framework will wait until the CPU is free before proceeding with the requested push().
push in class ProtocolSessionProtocolException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||