##### OpenJMS

- Overview
- Downloads
- Release Notes
- Getting Started
- User Guide
  - Using OpenJMS
  - Examples
  - Client JARS
  - Connectors
    - TCP
    - TCPS
    - RMI
    - HTTP
    - HTTPS
    - Embedded
  - Administration API
- Administrator Guide
- Developer Guide
- FAQ

##### Search OpenJMS

##### Project Documentation

- About
- Project Info
- Project Reports
- Development Process

##### Legend

- External Link
- Opens in a new window

## Overview

The TCP connector enables OpenJMS clients to connect to the OpenJMS server using TCP/IP sockets.

## Using the TCP connector

To connect to an OpenJMS server running on the local host, using the default TCP configuration, construct an InitialContext as follows:

        Hashtable properties = new Hashtable();
        properties.put(Context.INITIAL_CONTEXT_FACTORY,
                       "org.exolab.jms.jndi.InitialContextFactory");
        properties.put(Context.PROVIDER_URL, "tcp://localhost:3035/");
        Context context = new InitialContext(properties);

The Context.PROVIDER_URL property has the format:

    "tcp://<server-host>:<jndi-port>/"

Where:

- server-host specifies the host that the OpenJMS server is running on.
- jndi-port specifies the port that the embedded JNDI provider is listening on.

## Administration using the TCP connector

To administer an OpenJMS server running on the local host, using the default TCP configuration, construct a JmsAdminServerIfc as follows:

        String url = "tcp://localhost:3035/";
        JmsAdminServerIfc admin = AdminConnectionFactory.create(url);

The URL argument has the format:

    "tcp://<server-host>:<server-port>/"

Where:

- server-host specifies the host that the OpenJMS server is running on.
- server-port specifies the port that the OpenJMS server is listening on.