## gnome-vfs-socket

gnome-vfs-socket —

## Synopsis

    GnomeVFSResult (*GnomeVFSSocketReadFunc)    (gpointer connection,
                                                 gpointer buffer,
                                                 GnomeVFSFileSize bytes,
                                                 GnomeVFSFileSize *bytes_read);
    GnomeVFSResult (*GnomeVFSSocketWriteFunc)   (gpointer connection,
                                                 gconstpointer buffer,
                                                 GnomeVFSFileSize bytes,
                                                 GnomeVFSFileSize *bytes_written);
    void        (*GnomeVFSSocketCloseFunc)      (gpointer connection);
    typedef     GnomeVFSSocketImpl;
    GnomeVFSSocket* gnome_vfs_socket_new        (GnomeVFSSocketImpl *impl,
                                                 void *connection);
    GnomeVFSResult gnome_vfs_socket_write       (GnomeVFSSocket *socket,
                                                 gconstpointer buffer,
                                                 int bytes,
                                                 GnomeVFSFileSize *bytes_written);
    GnomeVFSResult gnome_vfs_socket_close       (GnomeVFSSocket *socket);
    GnomeVFSResult gnome_vfs_socket_read        (GnomeVFSSocket *socket,
                                                 gpointer buffer,
                                                 GnomeVFSFileSize bytes,
                                                 GnomeVFSFileSize *bytes_read);

## Description

## Details

### GnomeVFSSocketReadFunc ()

    GnomeVFSResult (*GnomeVFSSocketReadFunc)    (gpointer connection,
                                                 gpointer buffer,
                                                 GnomeVFSFileSize bytes,
                                                 GnomeVFSFileSize *bytes_read);

`connection` : |
`buffer` : |
`bytes` : |
`bytes_read` : |
Returns : |

### GnomeVFSSocketWriteFunc ()

    GnomeVFSResult (*GnomeVFSSocketWriteFunc)   (gpointer connection,
                                                 gconstpointer buffer,
                                                 GnomeVFSFileSize bytes,
                                                 GnomeVFSFileSize *bytes_written);

`connection` : |
`buffer` : |
`bytes` : |
`bytes_written` : |
Returns : |

### GnomeVFSSocketCloseFunc ()

    void        (*GnomeVFSSocketCloseFunc)      (gpointer connection);

`connection` : |

### GnomeVFSSocketImpl

    typedef struct {
      GnomeVFSSocketReadFunc read;
      GnomeVFSSocketWriteFunc write;
      GnomeVFSSocketCloseFunc close;
    } GnomeVFSSocketImpl;

### gnome_vfs_socket_new ()

    GnomeVFSSocket* gnome_vfs_socket_new        (GnomeVFSSocketImpl *impl,
                                                 void *connection);

Creates a new GnomeVFS Socket using the specific implementation `impl`.

`impl` : | an implementation of a socket, e.g. GnomeVFSSSL
`connection` : | pointer to a connection object used by `impl` to track state (the exact nature of `connection` varies from implementation to implementation)
Returns : | a newly created socket

### gnome_vfs_socket_write ()

    GnomeVFSResult gnome_vfs_socket_write       (GnomeVFSSocket *socket,
                                                 gconstpointer buffer,
                                                 int bytes,
                                                 GnomeVFSFileSize *bytes_written);

Write `bytes` bytes of data from `buffer` to `socket`.

`socket` : | socket to write data to
`buffer` : | data to write to the socket
`bytes` : | number of bytes from `buffer` to write to `socket`
`bytes_written` : | pointer to a GnomeVFSFileSize, will contain the number of bytes actually written to the socket on return.
Returns : | GnomeVFSResult indicating the success of the operation

### gnome_vfs_socket_close ()

    GnomeVFSResult gnome_vfs_socket_close       (GnomeVFSSocket *socket);

Close `socket`, freeing any resources it may be using.

`socket` : | the socket to be closed
Returns : | GnomeVFSResult indicating the success of the operation

### gnome_vfs_socket_read ()

    GnomeVFSResult gnome_vfs_socket_read        (GnomeVFSSocket *socket,
                                                 gpointer buffer,
                                                 GnomeVFSFileSize bytes,
                                                 GnomeVFSFileSize *bytes_read);

Read `bytes` bytes of data from the `socket` into `buffer`.

`socket` : | socket to read data from
`buffer` : | allocated buffer of at least `bytes` bytes to be read into
`bytes` : | number of bytes to read from `socket` into `buffer`
`bytes_read` : | pointer to a GnomeVFSFileSize, will contain the number of bytes actually read from the socket on return.
Returns : | GnomeVFSResult indicating the success of the operation