example.message.router/src/example/message/client/ExampleMessageClient.java
public void connect(String ipAddress, Integer port)
    {
        if (m_SocketListener == null)
        {
            if (ipAddress == null)
            {
                ipAddress = m_IpAddress;
            }
            
            if (port == null)
            {
                port = m_Port;
            }
            
            try
            {
                m_Socket = new Socket(ipAddress, port); 
                m_Socket.getOutputStream().write(m_IdBytes);
                
                final Dictionary<String, Object> props = new Hashtable<>();
                props.put(SocketListener.PROP_SOCKET, m_Socket);
                
                m_ComponentInstance = m_SocketListenerFactory.newInstance(props);
                m_SocketListener = (SocketListener)m_ComponentInstance.getInstance();
                
                final Thread thread = new Thread(m_SocketListener);
                thread.setName("SocketListener-server-systemId-" + m_ServerSystemId);
                thread.start();
            }
            catch (final UnknownHostException ex)
            {
                m_Logging.error(ex, "Unknown host exception for %s:%s", ipAddress, port);
            }
            catch (final IOException ex)
            {
                m_Logging.error(ex, "IOException on connection %s:%s", ipAddress, port);
            }     
        }
        else
        {
            m_Logging.info("Client already connected. Disconnect first.");
        }
    }
/**
     * Connects to the example message router at the specified address.
     * 
     * @param ipAddress
     *      IP address of the message router to connect to.
     * @param port
     *      Port number of the message router to connect to.
     */
Connects to the example message router at the specified address.

@param ipAddress
IP address of the message router to connect to.
@param port
Port number of the message router to connect to.
Connects to the example message router at the specified address . @param ipAddress IP address of the message router to connect to . @param port Port number of the message router to connect to .
public void connect(String ipAddress, Integer port)
    {
        if (m_SocketListener == null)
        {
            if (ipAddress == null)
            {
                ipAddress = m_IpAddress;
            }
            if (port == null)
            {
                port = m_Port;
            }
            try
            {
                m_Socket = new Socket(ipAddress, port); 
                m_Socket.getOutputStream().write(m_IdBytes);
                final Dictionary<String, Object> props = new Hashtable<>();
                props.put(SocketListener.PROP_SOCKET, m_Socket);
                m_ComponentInstance = m_SocketListenerFactory.newInstance(props);
                m_SocketListener = (SocketListener)m_ComponentInstance.getInstance();
                final Thread thread = new Thread(m_SocketListener);
                thread.setName("SocketListener-server-systemId-" + m_ServerSystemId);
                thread.start();
            }
            catch (final UnknownHostException ex)
            {
                m_Logging.error(ex, "Unknown host exception for %s:%s", ipAddress, port);
            }
            catch (final IOException ex)
            {
                m_Logging.error(ex, "IOException on connection %s:%s", ipAddress, port);
            }     
        }
        else
        {
            m_Logging.info("Client already connected. Disconnect first.");
        }
    }
public void connect ( String ipAddress , Integer port ) { if ( m_SocketListener == null ) { if ( ipAddress == null ) { ipAddress = m_IpAddress ; } if ( port == null ) { port = m_Port ; } try { m_Socket = new Socket ( ipAddress , port ) ; m_Socket . getOutputStream ( ) . write ( m_IdBytes ) ; final Dictionary < String , Object > props = new Hashtable < > ( ) ; props . put ( SocketListener . PROP_SOCKET , m_Socket ) ; m_ComponentInstance = m_SocketListenerFactory . newInstance ( props ) ; m_SocketListener = ( SocketListener ) m_ComponentInstance . getInstance ( ) ; final Thread thread = new Thread ( m_SocketListener ) ; thread . setName ( "SocketListener-server-systemId-" + m_ServerSystemId ) ; thread . start ( ) ; } catch ( final UnknownHostException ex ) { m_Logging . error ( ex , "Unknown host exception for %s:%s" , ipAddress , port ) ; } catch ( final IOException ex ) { m_Logging . error ( ex , "IOException on connection %s:%s" , ipAddress , port ) ; } } else { m_Logging . info ( "Client already connected. Disconnect first." ) ; } }
Connects to the example message router at the specified address.
Connects to the example message router at the specified address .