Package net.dona.doip.client.transport

## Class TransportDoipClient

- java.lang.Object
- - net.dona.doip.client.transport.TransportDoipClient

- All Implemented Interfaces:
    `java.lang.AutoCloseable`

      public class TransportDoipClient
      extends java.lang.Object
      implements java.lang.AutoCloseable

  A DOIP client close to the transport protocol. It can connect to DOIP servers yielding instances of `DoipConnection` which are used to communicate with the server. The user can call `close()` to close all connections.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TransportDoipClient()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` | Closes all connections.
    `DoipConnection` | `connect​(java.net.InetAddress address, int port)` | Connects to a server by specifying an IP address and port, using default timeouts of one minute, trusting any provided server certificate, and not supplying a client certificate.
    `DoipConnection` | `connect​(java.net.InetAddress address, int port, int connectTimeoutMs, int readTimeoutMs)` | Connects to a server by specifying an IP address and port, using the specified timeouts, trusting any provided server certificate, and not supplying a client certificate.
    `DoipConnection` | `connect​(java.net.InetAddress address, int port, javax.net.ssl.X509TrustManager serverTrustManager, javax.net.ssl.X509KeyManager clientKeyManager, int connectTimeoutMs, int readTimeoutMs)` | Connects to a server by specifying an IP address and port, using the specified timeouts, trusting server certificates according to the specified trust manager, and providing a client certificate using the specified key manager.
    `DoipConnection` | `connect​(ConnectionOptions options)` | Connect to a server using the specified connection options.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TransportDoipClient

          public TransportDoipClient()

  - ### Method Detail

    - #### connect

          public DoipConnection connect​(java.net.InetAddress address,
                                        int port)
                                 throws java.io.IOException

      Connects to a server by specifying an IP address and port, using default timeouts of one minute, trusting any provided server certificate, and not supplying a client certificate.
      Parameters:
        `address` -
        `port` -
      Returns:
        a DOIP connection for communicating with the specified server
      Throws:
        `java.io.IOException`

    - #### connect

          public DoipConnection connect​(java.net.InetAddress address,
                                        int port,
                                        int connectTimeoutMs,
                                        int readTimeoutMs)
                                 throws java.io.IOException

      Connects to a server by specifying an IP address and port, using the specified timeouts, trusting any provided server certificate, and not supplying a client certificate.
      Parameters:
        `address` -
        `port` -
        `connectTimeoutMs` -
        `readTimeoutMs` -
      Returns:
        a DOIP connection for communicating with the specified server
      Throws:
        `java.io.IOException`

    - #### connect

          public DoipConnection connect​(ConnectionOptions options)
                                 throws java.io.IOException

      Connect to a server using the specified connection options.
      Parameters:
        `options` -
      Returns:
        a DOIP connection for communicating with the specified server
      Throws:
        `java.io.IOException`

    - #### connect

          public DoipConnection connect​(java.net.InetAddress address,
                                        int port,
                                        javax.net.ssl.X509TrustManager serverTrustManager,
                                        javax.net.ssl.X509KeyManager clientKeyManager,
                                        int connectTimeoutMs,
                                        int readTimeoutMs)
                                 throws java.io.IOException

      Connects to a server by specifying an IP address and port, using the specified timeouts, trusting server certificates according to the specified trust manager, and providing a client certificate using the specified key manager.
      Parameters:
        `address` -
        `port` -
        `serverTrustManager` - a trust manager defining which server certificates to trust; if null trust every server
        `clientKeyManager` - a key manager defining which client certificate to provide; if null provide no client certificate
        `connectTimeoutMs` -
        `readTimeoutMs` -
      Returns:
        a DOIP connection for communicating with the specified server
      Throws:
        `java.io.IOException`

    - #### close

          public void close()

      Closes all connections.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`