com.mysql.cj.protocol

## Interface SocketConnection

    public interface SocketConnection

Represents physical connection with endpoint

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`void` `connect(String host, int port, PropertySet propertySet, ExceptionInterceptor exceptionInterceptor, Log log, int loginTimeout)` Connect to the MySQL server and setup a stream connection.
`void` `forceClose()`
`ExceptionInterceptor` `getExceptionInterceptor()`
`String` `getHost()` Returns the host this IO is connected to
`FullReadInputStream` `getMysqlInput()`
`BufferedOutputStream` `getMysqlOutput()`
`Socket` `getMysqlSocket()`
`NetworkResources` `getNetworkResources()`
`int` `getPort()`
`PropertySet` `getPropertySet()`
`SocketFactory` `getSocketFactory()`
`boolean` `isSSLEstablished()`
`void` `performTlsHandshake(ServerSession serverSession)`
`default void` `performTlsHandshake(ServerSession serverSession, Log log)` Start a TLS handshake
`void` `setMysqlInput(FullReadInputStream mysqlInput)`
`void` `setSocketFactory(SocketFactory socketFactory)`

### Method Detail

#### connect

    void connect(String host,
                 int port,
                 PropertySet propertySet,
                 ExceptionInterceptor exceptionInterceptor,
                 Log log,
                 int loginTimeout)

Connect to the MySQL server and setup a stream connection.

Parameters:
  `host` - the hostname to connect to
  `port` - the port number that the server is listening on
  `propertySet` - the PropertySet with required connection options
  `exceptionInterceptor` - exception interceptor
  `log` - logger
  `loginTimeout` - the driver login time limit in milliseconds

#### performTlsHandshake

    void performTlsHandshake(ServerSession serverSession)
                      throws SSLParamsException,
                             FeatureNotAvailableException,
                             IOException

Throws:
  `SSLParamsException`
  `FeatureNotAvailableException`
  `IOException`

#### performTlsHandshake

    default void performTlsHandshake(ServerSession serverSession,
                                     Log log)
                              throws SSLParamsException,
                                     FeatureNotAvailableException,
                                     IOException

Start a TLS handshake

Parameters:
  `serverSession` - server session state object
  `log` - logger
Throws:
  `SSLParamsException` - in case of failure
  `FeatureNotAvailableException` - in case of failure
  `IOException` - in case of failure

#### forceClose

    void forceClose()

#### getNetworkResources

    NetworkResources getNetworkResources()

#### getHost

    String getHost()

Returns the host this IO is connected to

Returns:
  host name

#### getPort

    int getPort()

#### getMysqlSocket

    Socket getMysqlSocket()
                   throws IOException

Throws:
  `IOException`

#### getMysqlInput

    FullReadInputStream getMysqlInput()
                               throws IOException

Throws:
  `IOException`

#### setMysqlInput

    void setMysqlInput(FullReadInputStream mysqlInput)

#### getMysqlOutput

    BufferedOutputStream getMysqlOutput()
                                 throws IOException

Throws:
  `IOException`

#### isSSLEstablished

    boolean isSSLEstablished()

#### getSocketFactory

    SocketFactory getSocketFactory()

#### setSocketFactory

    void setSocketFactory(SocketFactory socketFactory)

#### getExceptionInterceptor

    ExceptionInterceptor getExceptionInterceptor()

#### getPropertySet

    PropertySet getPropertySet()

Copyright © 2016, 2026, Oracle and/or its affiliates.