## Internet connection Internet connection — Simple TCP/IP connection functions. |

## Synopsis

    typedef             MateVFSInetConnection;
    MateVFSResult      mate_vfs_inet_connection_create    (MateVFSInetConnection **connection_return,
                                                             const gchar *host_name,
                                                             guint host_port,
                                                             MateVFSCancellation *cancellation);
    void                mate_vfs_inet_connection_destroy   (MateVFSInetConnection *connection,
                                                             MateVFSCancellation *cancellation);
    void                mate_vfs_inet_connection_free      (MateVFSInetConnection *connection,
                                                             MateVFSCancellation *cancellation);
    MateVFSSocket *    mate_vfs_inet_connection_to_socket (MateVFSInetConnection *connection);
    MateVFSSocketBuffer * mate_vfs_inet_connection_to_socket_buffer
                                                            (MateVFSInetConnection *connection);
    int                 mate_vfs_inet_connection_get_fd    (MateVFSInetConnection *connection);
    MateVFSResult      mate_vfs_inet_connection_create_from_address
                                                            (MateVFSInetConnection **connection_return,
                                                             MateVFSAddress *address,
                                                             guint host_port,
                                                             MateVFSCancellation *cancellation);
    MateVFSAddress *   mate_vfs_inet_connection_get_address
                                                            (MateVFSInetConnection *connection);
    char *              mate_vfs_inet_connection_get_ip    (MateVFSInetConnection *connection);

## Description

A MateVFSInetConnection represents a TCP/IP connection. You can either use mate_vfs_inet_connection_create which will use the mate_vfs_resolve DNS resolution functions internally or you can do the name resolution yourself and use mate_vfs_inet_connection_create_from_address to connect to a specific address. After a connection has been established all I/O is done through a MateVFSSocket or a MateVFSSocketBuffer.

## Details

### MateVFSInetConnection

    typedef struct MateVFSInetConnection MateVFSInetConnection;

### mate_vfs_inet_connection_create ()

    MateVFSResult      mate_vfs_inet_connection_create    (MateVFSInetConnection **connection_return,
                                                             const gchar *host_name,
                                                             guint host_port,
                                                             MateVFSCancellation *cancellation);

Creates a connection at `connection_return` to `host_name` using port `port`.

`connection_return` : | pointer to a pointer to a MateVFSInetConnection, which will contain an allocated MateVFSInetConnection object on return.
`host_name` : | string indicating the host to establish an internet connection with.
`host_port` : | port number to connect to.
`cancellation` : | handle allowing cancellation of the operation.
Returns : | MateVFSResult indicating the success of the operation.

### mate_vfs_inet_connection_destroy ()

    void                mate_vfs_inet_connection_destroy   (MateVFSInetConnection *connection,
                                                             MateVFSCancellation *cancellation);

Closes/Destroys `connection`.

`connection` : | connection to destroy.
`cancellation` : | handle for cancelling the operation.

### mate_vfs_inet_connection_free ()

    void                mate_vfs_inet_connection_free      (MateVFSInetConnection *connection,
                                                             MateVFSCancellation *cancellation);

Frees `connection` without closing the socket.

`connection` : | connection to free.
`cancellation` : | handle for cancelling the operation.

### mate_vfs_inet_connection_to_socket ()

    MateVFSSocket *    mate_vfs_inet_connection_to_socket (MateVFSInetConnection *connection);

Wrap `connection` inside a standard MateVFSSocket for convenience.

`connection` : | connection to be wrapped into a MateVFSSocket.
Returns : | a newly created MateVFSSocket around `connection`.

### mate_vfs_inet_connection_to_socket_buffer ()

    MateVFSSocketBuffer * mate_vfs_inet_connection_to_socket_buffer
                                                            (MateVFSInetConnection *connection);

Wrap `connection` inside a standard MateVFSSocketBuffer for convenience.

`connection` : | connection to be wrapped into a MateVFSSocketBuffer.
Returns : | a newly created MateVFSSocketBuffer around `connection`.

### mate_vfs_inet_connection_get_fd ()

    int                 mate_vfs_inet_connection_get_fd    (MateVFSInetConnection *connection);

Retrieve the UNIX file descriptor corresponding to `connection`.

`connection` : | connection to get the file descriptor from.
Returns : | file descriptor.

### mate_vfs_inet_connection_create_from_address ()

    MateVFSResult      mate_vfs_inet_connection_create_from_address
                                                            (MateVFSInetConnection **connection_return,
                                                             MateVFSAddress *address,
                                                             guint host_port,
                                                             MateVFSCancellation *cancellation);

Creates a connection at `connection_return` to `address` using port `port`.

`connection_return` : | pointer to a pointer to a MateVFSInetConnection, which will contain an allocated MateVFSInetConnection object on return.
`address` : | a valid MateVFSAddress.
`host_port` : | port number to connect to.
`cancellation` : | handle allowing cancellation of the operation.
Returns : | MateVFSResult indicating the success of the operation.

Since 2.8

### mate_vfs_inet_connection_get_address ()

    MateVFSAddress *   mate_vfs_inet_connection_get_address
                                                            (MateVFSInetConnection *connection);

Retrieve the address of the other side of a connected `connection`.

`connection` : | connection to get the address from.
Returns : | a MateVFSAddress containing the address. Since 2.8

### mate_vfs_inet_connection_get_ip ()

    char *              mate_vfs_inet_connection_get_ip    (MateVFSInetConnection *connection);

Retrieve the ip address of the other side of a connected `connection`.

`connection` : | connection to get the ip from.
Returns : | string version of the ip.

Since 2.8