lcm.lcm
Class TCPProvider

java.lang.Object
  extended by lcm.lcm.TCPProvider
All Implemented Interfaces:
Provider

public class TCPProvider
extends java.lang.Object
implements Provider

LCM provider for the tcpq: URL. All messages are sent to a central "hub" process (that must be started separately), which will relay the messages to all other processes. TCPService is an implementation of the hub process. The tcpq:// protocol is NOT suitable for real-time or high-bandwidth traffic. It is specifically designed for playing back a log file in a post-processing context (i.e., play back the log as fast as possible, but without dropping anything).


Field Summary
static int MAGIC_CLIENT
           
static int MAGIC_SERVER
           
static int MESSAGE_TYPE_PUBLISH
           
static int MESSAGE_TYPE_SUBSCRIBE
           
static int MESSAGE_TYPE_UNSUBSCRIBE
           
static int VERSION
           
 
Constructor Summary
TCPProvider(LCM lcm, URLParser up)
           
 
Method Summary
 void close()
          close() will be called when the application no longer requires the provider and wishes to free the resources used by the provider.
 void publish(java.lang.String channel, byte[] data, int offset, int length)
          Publish a message synchronously.
 void subscribe(java.lang.String channel)
          subscribe() will be called when a channel subscription has been made.
 void unsubscribe(java.lang.String channel)
          unsubscribe() will be called when a channel subscription is cancelled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGIC_SERVER

public static final int MAGIC_SERVER
See Also:
Constant Field Values

MAGIC_CLIENT

public static final int MAGIC_CLIENT
See Also:
Constant Field Values

VERSION

public static final int VERSION
See Also:
Constant Field Values

MESSAGE_TYPE_PUBLISH

public static final int MESSAGE_TYPE_PUBLISH
See Also:
Constant Field Values

MESSAGE_TYPE_SUBSCRIBE

public static final int MESSAGE_TYPE_SUBSCRIBE
See Also:
Constant Field Values

MESSAGE_TYPE_UNSUBSCRIBE

public static final int MESSAGE_TYPE_UNSUBSCRIBE
See Also:
Constant Field Values
Constructor Detail

TCPProvider

public TCPProvider(LCM lcm,
                   URLParser up)
            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

publish

public void publish(java.lang.String channel,
                    byte[] data,
                    int offset,
                    int length)
Publish a message synchronously. However, if the server is not available, it will return immediately.

Specified by:
publish in interface Provider

subscribe

public void subscribe(java.lang.String channel)
Description copied from interface: Provider
subscribe() will be called when a channel subscription has been made. Providers that do not use a broadcast communications mechanism could use this notification to establish communications with additional hosts.

Specified by:
subscribe in interface Provider

unsubscribe

public void unsubscribe(java.lang.String channel)
Description copied from interface: Provider
unsubscribe() will be called when a channel subscription is cancelled.

Specified by:
unsubscribe in interface Provider

close

public void close()
Description copied from interface: Provider
close() will be called when the application no longer requires the provider and wishes to free the resources used by the provider. For example, file handles and network sockets should be closed. After this method is called, the results of any calls to publish or subscribe are undefined.

Specified by:
close in interface Provider