Package org.mariadb.jdbc.client.socket.impl

## Class UnixDomainSocket

- java.lang.Object
- - java.net.Socket
  - - org.mariadb.jdbc.client.socket.impl.UnixDomainSocket

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

    public class UnixDomainSocket
    extends Socket

Unix IPC socket

### Nested Class Summary

Nested Classes
`static class` `UnixDomainSocket.SockAddr` Socket address

### Constructor Summary

Constructors
`UnixDomainSocket​(String path)` Constructor

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()`
`static int` `close​(int fd)` Close socket
`static int` `connect​(int sockfd, UnixDomainSocket.SockAddr sockaddr, int addrlen)` Connect socket
`void` `connect​(SocketAddress endpoint, int timeout)`
`InputStream` `getInputStream()`
`OutputStream` `getOutputStream()`
`boolean` `isConnected()`
`static int` `recv​(int fd, byte[] buffer, int count, int flags)` Receive a message from a socket
`static int` `send​(int fd, byte[] buffer, int count, int flags)` Send a message to a socket
`void` `setKeepAlive​(boolean b)`
`void` `setSoLinger​(boolean b, int i)`
`void` `setSoTimeout​(int timeout)`
`void` `setTcpNoDelay​(boolean b)`
`void` `shutdownInput()`
`void` `shutdownOutput()`
`static int` `socket​(int domain, int type, int protocol)` creates an endpoint for communication and returns a file descriptor that refers to that endpoint.
`static String` `strerror​(int errno)` return a description of the error code passed in the argument errnum.

### Methods inherited from class java.net.Socket

`bind, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isInputShutdown, isOutputShutdown, sendUrgentData, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setTrafficClass, supportedOptions, toString`

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

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

### Constructor Detail

#### UnixDomainSocket

    public UnixDomainSocket​(String path)
                     throws IOException

Constructor

Parameters:
  `path` - unix path
Throws:
  `IOException` - if any error occurs

### Method Detail

#### socket

    public static int socket​(int domain,
                             int type,
                             int protocol)
                      throws com.sun.jna.LastErrorException

creates an endpoint for communication and returns a file descriptor that refers to that endpoint. see https://man7.org/linux/man-pages/man2/socket.2.html

Parameters:
  `domain` - domain
  `type` - type
  `protocol` - protocol
Returns:
  file descriptor
Throws:
  `com.sun.jna.LastErrorException` - if any error occurs

#### connect

    public static int connect​(int sockfd,
                              UnixDomainSocket.SockAddr sockaddr,
                              int addrlen)
                       throws com.sun.jna.LastErrorException

Connect socket

Parameters:
  `sockfd` - file descriptor
  `sockaddr` - socket address
  `addrlen` - address length
Returns:
  zero on success. -1 on error
Throws:
  `com.sun.jna.LastErrorException` - if error occurs

#### recv

    public static int recv​(int fd,
                           byte[] buffer,
                           int count,
                           int flags)
                    throws com.sun.jna.LastErrorException

Receive a message from a socket

Parameters:
  `fd` - file descriptor
  `buffer` - buffer
  `count` - length
  `flags` - flag. see https://man7.org/linux/man-pages/man2/recvmsg.2.html
Returns:
  zero on success. -1 on error
Throws:
  `com.sun.jna.LastErrorException` - if error occurs

#### send

    public static int send​(int fd,
                           byte[] buffer,
                           int count,
                           int flags)
                    throws com.sun.jna.LastErrorException

Send a message to a socket

Parameters:
  `fd` - file descriptor
  `buffer` - buffer
  `count` - length
  `flags` - flag. see https://man7.org/linux/man-pages/man2/sendmsg.2.html
Returns:
  zero on success. -1 on error
Throws:
  `com.sun.jna.LastErrorException` - if error occurs

#### close

    public static int close​(int fd)
                     throws com.sun.jna.LastErrorException

Close socket

Parameters:
  `fd` - file descriptor
Returns:
  zero on success. -1 on error
Throws:
  `com.sun.jna.LastErrorException` - if error occurs

#### strerror

    public static String strerror​(int errno)

return a description of the error code passed in the argument errnum.

Parameters:
  `errno` - error pointer
Returns:
  error description

#### isConnected

    public boolean isConnected()

Overrides:
  `isConnected` in class `Socket`

#### close

    public void close()
               throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `Socket`
Throws:
  `IOException`

#### connect

    public void connect​(SocketAddress endpoint,
                        int timeout)
                 throws IOException

Overrides:
  `connect` in class `Socket`
Throws:
  `IOException`

#### getInputStream

    public InputStream getInputStream()

Overrides:
  `getInputStream` in class `Socket`

#### getOutputStream

    public OutputStream getOutputStream()

Overrides:
  `getOutputStream` in class `Socket`

#### setTcpNoDelay

    public void setTcpNoDelay​(boolean b)

Overrides:
  `setTcpNoDelay` in class `Socket`

#### setKeepAlive

    public void setKeepAlive​(boolean b)

Overrides:
  `setKeepAlive` in class `Socket`

#### setSoLinger

    public void setSoLinger​(boolean b,
                            int i)

Overrides:
  `setSoLinger` in class `Socket`

#### setSoTimeout

    public void setSoTimeout​(int timeout)

Overrides:
  `setSoTimeout` in class `Socket`

#### shutdownInput

    public void shutdownInput()

Overrides:
  `shutdownInput` in class `Socket`

#### shutdownOutput

    public void shutdownOutput()

Overrides:
  `shutdownOutput` in class `Socket`