Skip to Main Content U.S. Department of Energy
 

TCP Protocol

Creating and Configuring a TCP Connector

To create a TCP connector, use code similar to the following. The second argument indicates that outbound endpoints should keep their send sockets open. Otherwise, the socket will be opened and closed for each transmission. For medium to high throughput applications this should be set to true.

pipeline.addMifTcpConnector("myTcpConnector", true);

Creating a TCP endpoint

To create a TCP inbound endpoint on host hostname listening on port 12345, you could use the following code. The endpoint inEndp can then be added as the inbound endpoint to any MifModule. This inbound endpoint will act as a TCP listener.

MifEndpoint inEndp = pipeline.addMifEndpoint("inSocket", EndpointType.TCP, "hostname:12345");

The same code can be used for an outbound endpoint by setting it as such on the MifModule. In this case the endpoint will act as a TCP client calling send().

 
tcp.txt · Last modified: 2008/05/13 07:37 by adamw