public final class EmuClient extends cMsgDomainAdapter
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
EmuClient.Multicaster
This class defines a thread to multicast a UDP packet to the
Emu server every second.
|
(package private) class |
EmuClient.MulticastReceiver
This class gets any response to our UDP multicast.
|
connected, debug, description, domain, host, name, receiving, shutdownHandler, UDL, UDLremainder| Constructor and Description |
|---|
EmuClient()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Method to connect to the server from this client.
|
void |
disconnect()
Method to close the connection to the domain server.
|
void |
flush(int timeout)
Method to force cMsg client to send pending communications with domain.
|
java.lang.String |
getServerHost()
Get the host of the emu server that this client is connected to.
|
int |
getServerPort()
Get the TCP port of the emu server that this client is connected to.
|
void |
parseUDL(java.lang.String udlRemainder)
Method to parse the Universal Domain Locator (UDL) into its various components.
|
(package private) void |
parseUDLOld(java.lang.String udlRemainder)
Method to parse the Universal Domain Locator (UDL) into its various components.
|
void |
send(cMsgMessage message)
Method to send a message to the Emu domain server.
|
getCurrentUDL, getDebug, getDescription, getDomain, getHost, getInfo, getName, getShutdownHandler, getUDL, getUDLRemainder, isConnected, isReceiving, monitor, sendAndGet, setDebug, setDescription, setName, setShutdownHandler, setUDL, setUDLRemainder, shutdownClients, shutdownServers, start, stop, subscribe, subscribeAndGet, syncSend, unsubscribepublic EmuClient()
throws cMsgException
cMsgException - if cMsg error.public java.lang.String getServerHost()
getServerHost in interface cMsgDomainInterfacegetServerHost in class cMsgDomainAdapterpublic int getServerPort()
getServerPort in interface cMsgDomainInterfacegetServerPort in class cMsgDomainAdapterpublic void connect()
throws cMsgException
connect in interface cMsgDomainInterfaceconnect in class cMsgDomainAdaptercMsgException - if there are problems parsing the UDL or
communication problems with the server(s)void parseUDLOld(java.lang.String udlRemainder)
throws cMsgException
cMsg:emu://<port>/<expid>/<compName>?codaId=<id>&timeout=<sec>&bufSize=<size>&tcpSend=<size>&subnet=<subnet>&sockets=<count>&noDelay
Remember that for this domain:
multicast address is always 239.230.0.0
port is required - UDP multicast port
expid is required
compName is required - destination CODA component name
codaId is required
optional timeout for connecting to emu server, defaults to 3 seconds
optional bufSize (max size in bytes of a single send) defaults to 2.1MB
optional tcpSend is the TCP send buffer size in bytes
optional subnet is the preferred subnet used to connect to server
optional sockets is the number of TCP sockets to use when connecting to server
optional noDelay is the TCP no-delay parameter turned on
udlRemainder - partial UDL to parsecMsgException - if udlRemainder is nullpublic void parseUDL(java.lang.String udlRemainder)
throws cMsgException
emu://<host>:<port>/<expid>/<compName>?codaId=<id>&broad=<ip>&timeout=<sec>&bufSize=<size>&tcpSend=<size>&subnet=<subnet>&sockets=<count>&noDelay
Remember that for this domain:
host is optional and may be "multicast" (default) or in dotted decimal form
port is required - UDP multicast port if host = "multicast", or TCP port
expid is required, it is NOT taken from the environmental variable EXPID
optional timeout for connecting to emu server, defaults to 3 seconds
optional bufSize (max size in bytes of a single send) defaults to 2.1MB
optional tcpSend is the TCP send buffer size in bytes
optional subnet is the preferred subnet used to connect to server when multicasting, or the subnet corresponding to the host IP address if directly connecting.
optional sockets is the number of TCP sockets to use when connecting to server
optional noDelay is the TCP no-delay parameter turned on
udlRemainder - partial UDL to parsecMsgException - if udlRemainder is nullpublic void flush(int timeout)
throws cMsgException
flush in interface cMsgDomainInterfaceflush in class cMsgDomainAdaptertimeout - time in milliseconds to wait for completioncMsgException - if I/O exception on the output stream flush.public void disconnect()
disconnect in interface cMsgDomainInterfacedisconnect in class cMsgDomainAdapterpublic void send(cMsgMessage message) throws cMsgException
send in interface cMsgDomainInterfacesend in class cMsgDomainAdaptermessage - message to sendcMsgException - if there are communication problems with the server;
subject and/or type is null