~ubuntu-branches/ubuntu/natty/gnome-vfs/natty

« back to all changes in this revision

Viewing changes to doc/html/gnome-vfs-20-gnome-vfs-socket.html

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2009-03-17 16:12:58 UTC
  • mfrom: (0.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090317161258-px3a2czt9g2ktjz3
Tags: 1:2.24.1-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
 
<html>
3
 
<head>
4
 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
 
<title>Unified network I/O</title>
6
 
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
 
<link rel="start" href="index.html" title="GnomeVFS - Filesystem Abstraction library">
8
 
<link rel="up" href="networking.html" title="Networking">
9
 
<link rel="prev" href="gnome-vfs-20-gnome-vfs-ssl.html" title="SSL support functions">
10
 
<link rel="next" href="gnome-vfs-20-gnome-vfs-socket-buffer.html" title="Unified bufferd network I/O">
11
 
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
 
<link rel="stylesheet" href="style.css" type="text/css">
13
 
<link rel="chapter" href="about.html" title="Introduction to GnomeVFS">
14
 
<link rel="chapter" href="data-types.html" title="Basic Data Types">
15
 
<link rel="chapter" href="gnome-vfs-basic-file-ops.html" title="File Operations">
16
 
<link rel="chapter" href="gnome-vfs-directory-ops.html" title="Directory-Specific Operations">
17
 
<link rel="chapter" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
18
 
<link rel="chapter" href="gnome-vfs-file-async-ops.html" title="Asynchronous Operations">
19
 
<link rel="chapter" href="volumes.html" title="Volumes and Drives Handling">
20
 
<link rel="chapter" href="networking.html" title="Networking">
21
 
<link rel="chapter" href="mime-registry.html" title="MIME Registry">
22
 
<link rel="chapter" href="modules.html" title="Filesystem Modules">
23
 
</head>
24
 
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
25
 
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
26
 
<tr valign="middle">
27
 
<td><a accesskey="p" href="gnome-vfs-20-gnome-vfs-ssl.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
28
 
<td><a accesskey="u" href="networking.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
29
 
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
30
 
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
31
 
<td><a accesskey="n" href="gnome-vfs-20-gnome-vfs-socket-buffer.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
32
 
</tr>
33
 
<tr><td colspan="5" class="shortcuts">
34
 
<a href="#gnome-vfs-20-gnome-vfs-socket.synopsis" class="shortcut">Top</a>
35
 
                 | 
36
 
                <a href="#gnome-vfs-20-gnome-vfs-socket.description" class="shortcut">Description</a>
37
 
</td></tr>
38
 
</table>
39
 
<div class="refentry" lang="en">
40
 
<a name="gnome-vfs-20-gnome-vfs-socket"></a><div class="titlepage"></div>
41
 
<div class="refnamediv"><table width="100%"><tr>
42
 
<td valign="top">
43
 
<h2><span class="refentrytitle"><a name="gnome-vfs-20-gnome-vfs-socket.top_of_page"></a>Unified network I/O</span></h2>
44
 
<p>Unified network I/O — Posix style network input/output functions.</p>
45
 
</td>
46
 
<td valign="top" align="right"></td>
47
 
</tr></table></div>
48
 
<div class="refsynopsisdiv">
49
 
<a name="gnome-vfs-20-gnome-vfs-socket.synopsis"></a><h2>Synopsis</h2>
50
 
<pre class="synopsis">
51
 
typedef             <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>;
52
 
                    <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a>;
53
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc" title="GnomeVFSSocketReadFunc ()">*GnomeVFSSocketReadFunc</a>)           (gpointer connection,
54
 
                                                         gpointer buffer,
55
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
56
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read_out,
57
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
58
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc" title="GnomeVFSSocketWriteFunc ()">*GnomeVFSSocketWriteFunc</a>)          (gpointer connection,
59
 
                                                         gconstpointer buffer,
60
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
61
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
62
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
63
 
void                (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()">*GnomeVFSSocketCloseFunc</a>)          (gpointer connection,
64
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
65
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc" title="GnomeVFSSocketSetTimeoutFunc ()">*GnomeVFSSocketSetTimeoutFunc</a>)     (gpointer connection,
66
 
                                                         GTimeVal *timeout,
67
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
68
 
<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>*     <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new" title="gnome_vfs_socket_new ()">gnome_vfs_socket_new</a>                (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a> *impl,
69
 
                                                         void *connection);
70
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-write" title="gnome_vfs_socket_write ()">gnome_vfs_socket_write</a>              (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
71
 
                                                         gconstpointer buffer,
72
 
                                                         int bytes,
73
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written,
74
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
75
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-close" title="gnome_vfs_socket_close ()">gnome_vfs_socket_close</a>              (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
76
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
77
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-read" title="gnome_vfs_socket_read ()">gnome_vfs_socket_read</a>               (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
78
 
                                                         gpointer buffer,
79
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
80
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read,
81
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
82
 
void                <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-free" title="gnome_vfs_socket_free ()">gnome_vfs_socket_free</a>               (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket);
83
 
<a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout" title="gnome_vfs_socket_set_timeout ()">gnome_vfs_socket_set_timeout</a>        (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
84
 
                                                         GTimeVal *timeout,
85
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);
86
 
</pre>
87
 
</div>
88
 
<div class="refsect1" lang="en">
89
 
<a name="gnome-vfs-20-gnome-vfs-socket.description"></a><h2>Description</h2>
90
 
<p>
91
 
The GnomeVFSSocket function family unifies network I/O through functions
92
 
similar to the standard POSIX read/write functions. The main difference is
93
 
that all operations are cancellable through the standard GnomeVFS cancellation
94
 
mechanism and you can specify a maximum amount of time an operation may take
95
 
through <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout" title="gnome_vfs_socket_set_timeout ()"><span class="type">gnome_vfs_socket_set_timeout</span></a>.
96
 
</p>
97
 
</div>
98
 
<div class="refsect1" lang="en">
99
 
<a name="gnome-vfs-20-gnome-vfs-socket.details"></a><h2>Details</h2>
100
 
<div class="refsect2" lang="en">
101
 
<a name="GnomeVFSSocket"></a><h3>GnomeVFSSocket</h3>
102
 
<pre class="programlisting">typedef struct GnomeVFSSocket GnomeVFSSocket;
103
 
</pre>
104
 
<p>
105
 
An handle to a generic unbuffered socket connection established with
106
 
<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new" title="gnome_vfs_socket_new ()"><code class="function">gnome_vfs_socket_new()</code></a>.
107
 
</p>
108
 
<p>
109
 
The specifics of the underlying socket implementation are hidden
110
 
inside the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a> passed on construction.
111
 
</p>
112
 
<p>
113
 
If you need buffered I/O, you will also have to create a
114
 
<a class="link" href="gnome-vfs-20-gnome-vfs-socket-buffer.html#GnomeVFSSocketBuffer" title="GnomeVFSSocketBuffer"><span class="type">GnomeVFSSocketBuffer</span></a>.</p>
115
 
<p>
116
 
</p>
117
 
</div>
118
 
<hr>
119
 
<div class="refsect2" lang="en">
120
 
<a name="GnomeVFSSocketImpl"></a><h3>GnomeVFSSocketImpl</h3>
121
 
<pre class="programlisting">typedef struct {
122
 
  GnomeVFSSocketReadFunc read;
123
 
  GnomeVFSSocketWriteFunc write;
124
 
  GnomeVFSSocketCloseFunc close;
125
 
  GnomeVFSSocketSetTimeoutFunc set_timeout;
126
 
} GnomeVFSSocketImpl;
127
 
</pre>
128
 
<p>
129
 
An implementation of a generic socket (i.e. of <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket"><span class="type">GnomeVFSSocket</span></a>)
130
 
encapsulating the details of how socket I/O works.
131
 
</p>
132
 
<p>
133
 
Please refer to <a class="link" href="gnome-vfs-20-gnome-vfs-ssl.html#GnomeVFSSSL" title="GnomeVFSSSL"><span class="type">GnomeVFSSSL</span></a> for a sample implementation of this interface.</p>
134
 
<p>
135
 
</p>
136
 
<div class="variablelist"><table border="0">
137
 
<col align="left" valign="top">
138
 
<tbody>
139
 
<tr>
140
 
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc" title="GnomeVFSSocketReadFunc ()">GnomeVFSSocketReadFunc</a> <em class="structfield"><code>read</code></em>;</span></p></td>
141
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketReadFunc" title="GnomeVFSSocketReadFunc ()"><span class="type">GnomeVFSSocketReadFunc</span></a> function used for reading from a socket.
142
 
</td>
143
 
</tr>
144
 
<tr>
145
 
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc" title="GnomeVFSSocketWriteFunc ()">GnomeVFSSocketWriteFunc</a> <em class="structfield"><code>write</code></em>;</span></p></td>
146
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketWriteFunc" title="GnomeVFSSocketWriteFunc ()"><span class="type">GnomeVFSSocketWriteFunc</span></a> function used for writing to a socket.
147
 
</td>
148
 
</tr>
149
 
<tr>
150
 
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()">GnomeVFSSocketCloseFunc</a> <em class="structfield"><code>close</code></em>;</span></p></td>
151
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketCloseFunc" title="GnomeVFSSocketCloseFunc ()"><span class="type">GnomeVFSSocketCloseFunc</span></a> function used for closing an open socket.
152
 
</td>
153
 
</tr>
154
 
<tr>
155
 
<td><p><span class="term"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc" title="GnomeVFSSocketSetTimeoutFunc ()">GnomeVFSSocketSetTimeoutFunc</a> <em class="structfield"><code>set_timeout</code></em>;</span></p></td>
156
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketSetTimeoutFunc" title="GnomeVFSSocketSetTimeoutFunc ()"><span class="type">GnomeVFSSocketSetTimeoutFunc</span></a> function used for setting a socket's timeout.
157
 
</td>
158
 
</tr>
159
 
</tbody>
160
 
</table></div>
161
 
</div>
162
 
<hr>
163
 
<div class="refsect2" lang="en">
164
 
<a name="GnomeVFSSocketReadFunc"></a><h3>GnomeVFSSocketReadFunc ()</h3>
165
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      (*GnomeVFSSocketReadFunc)           (gpointer connection,
166
 
                                                         gpointer buffer,
167
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
168
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read_out,
169
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
170
 
<p>
171
 
This is a generic prototype for a function that reads from a socket.
172
 
</p>
173
 
<p>
174
 
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how data
175
 
should be written to a buffer using the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-read" title="gnome_vfs_socket_read ()"><code class="function">gnome_vfs_socket_read()</code></a>
176
 
function which hides the socket implementation details.</p>
177
 
<p>
178
 
</p>
179
 
<div class="variablelist"><table border="0">
180
 
<col align="left" valign="top">
181
 
<tbody>
182
 
<tr>
183
 
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
184
 
<td> The socket connection.
185
 
</td>
186
 
</tr>
187
 
<tr>
188
 
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
189
 
<td> A connection buffer.
190
 
</td>
191
 
</tr>
192
 
<tr>
193
 
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
194
 
<td> The bytes to read.
195
 
</td>
196
 
</tr>
197
 
<tr>
198
 
<td><p><span class="term"><em class="parameter"><code>bytes_read_out</code></em> :</span></p></td>
199
 
<td> The bytes that were read (out).
200
 
</td>
201
 
</tr>
202
 
<tr>
203
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
204
 
<td> A cancellation handle that allows clients to cancel the read operation.
205
 
</td>
206
 
</tr>
207
 
<tr>
208
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
209
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> signalling the result of the read operation.
210
 
</td>
211
 
</tr>
212
 
</tbody>
213
 
</table></div>
214
 
</div>
215
 
<hr>
216
 
<div class="refsect2" lang="en">
217
 
<a name="GnomeVFSSocketWriteFunc"></a><h3>GnomeVFSSocketWriteFunc ()</h3>
218
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      (*GnomeVFSSocketWriteFunc)          (gpointer connection,
219
 
                                                         gconstpointer buffer,
220
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
221
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written_out,
222
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
223
 
<p>
224
 
This is a generic prototype for a function that writes to a socket.
225
 
</p>
226
 
<p>
227
 
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how data
228
 
should be written to a buffer using the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-write" title="gnome_vfs_socket_write ()"><code class="function">gnome_vfs_socket_write()</code></a>
229
 
function which hides the socket implementation details.</p>
230
 
<p>
231
 
</p>
232
 
<div class="variablelist"><table border="0">
233
 
<col align="left" valign="top">
234
 
<tbody>
235
 
<tr>
236
 
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
237
 
<td> The socket connection.
238
 
</td>
239
 
</tr>
240
 
<tr>
241
 
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
242
 
<td> A connection buffer.
243
 
</td>
244
 
</tr>
245
 
<tr>
246
 
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
247
 
<td> The bytes to write.
248
 
</td>
249
 
</tr>
250
 
<tr>
251
 
<td><p><span class="term"><em class="parameter"><code>bytes_written_out</code></em> :</span></p></td>
252
 
<td> The bytes that were written.
253
 
</td>
254
 
</tr>
255
 
<tr>
256
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
257
 
<td> A cancellation handle that allows clients to cancel the write operation.
258
 
</td>
259
 
</tr>
260
 
<tr>
261
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
262
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> signalling the result of the write operation.
263
 
</td>
264
 
</tr>
265
 
</tbody>
266
 
</table></div>
267
 
</div>
268
 
<hr>
269
 
<div class="refsect2" lang="en">
270
 
<a name="GnomeVFSSocketCloseFunc"></a><h3>GnomeVFSSocketCloseFunc ()</h3>
271
 
<pre class="programlisting">void                (*GnomeVFSSocketCloseFunc)          (gpointer connection,
272
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
273
 
<p>
274
 
This is a generic prototype for a function that closes a socket.
275
 
</p>
276
 
<p>
277
 
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how an
278
 
open socket that was previously opened by <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-new" title="gnome_vfs_socket_new ()"><code class="function">gnome_vfs_socket_new()</code></a>
279
 
should be closed using the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-set-timeout" title="gnome_vfs_socket_set_timeout ()"><code class="function">gnome_vfs_socket_set_timeout()</code></a> function which
280
 
hides the socket implementation details.</p>
281
 
<p>
282
 
</p>
283
 
<div class="variablelist"><table border="0">
284
 
<col align="left" valign="top">
285
 
<tbody>
286
 
<tr>
287
 
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
288
 
<td>
289
 
</td>
290
 
</tr>
291
 
<tr>
292
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
293
 
<td> A cancellation handle that allows clients to cancel the write operation.
294
 
</td>
295
 
</tr>
296
 
</tbody>
297
 
</table></div>
298
 
</div>
299
 
<hr>
300
 
<div class="refsect2" lang="en">
301
 
<a name="GnomeVFSSocketSetTimeoutFunc"></a><h3>GnomeVFSSocketSetTimeoutFunc ()</h3>
302
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      (*GnomeVFSSocketSetTimeoutFunc)     (gpointer connection,
303
 
                                                         GTimeVal *timeout,
304
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
305
 
<p>
306
 
This is a generic prototype for a function that sets a socket timeout.
307
 
</p>
308
 
<p>
309
 
This function is implemented by a <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a>, and it defines how
310
 
a socket timeout should be set using 
311
 
should be closed by the <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#gnome-vfs-socket-close" title="gnome_vfs_socket_close ()"><code class="function">gnome_vfs_socket_close()</code></a> function which
312
 
hides the socket implementation details.</p>
313
 
<p>
314
 
</p>
315
 
<div class="variablelist"><table border="0">
316
 
<col align="left" valign="top">
317
 
<tbody>
318
 
<tr>
319
 
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
320
 
<td>
321
 
</td>
322
 
</tr>
323
 
<tr>
324
 
<td><p><span class="term"><em class="parameter"><code>timeout</code></em> :</span></p></td>
325
 
<td>
326
 
</td>
327
 
</tr>
328
 
<tr>
329
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
330
 
<td> A cancellation handle that allows clients to cancel the write operation.
331
 
</td>
332
 
</tr>
333
 
<tr>
334
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
335
 
<td> A <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> signalling the result of the write operation.
336
 
</td>
337
 
</tr>
338
 
</tbody>
339
 
</table></div>
340
 
</div>
341
 
<hr>
342
 
<div class="refsect2" lang="en">
343
 
<a name="gnome-vfs-socket-new"></a><h3>gnome_vfs_socket_new ()</h3>
344
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a>*     gnome_vfs_socket_new                (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl">GnomeVFSSocketImpl</a> *impl,
345
 
                                                         void *connection);</pre>
346
 
<p>
347
 
Creates a new <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket"><span class="type">GnomeVFSSocket</span></a> using the specific implementation
348
 
<em class="parameter"><code>impl</code></em>.</p>
349
 
<p>
350
 
</p>
351
 
<div class="variablelist"><table border="0">
352
 
<col align="left" valign="top">
353
 
<tbody>
354
 
<tr>
355
 
<td><p><span class="term"><em class="parameter"><code>impl</code></em> :</span></p></td>
356
 
<td> an implementation of socket, e.g. <a class="link" href="gnome-vfs-20-gnome-vfs-ssl.html#GnomeVFSSSL" title="GnomeVFSSSL"><span class="type">GnomeVFSSSL</span></a>.
357
 
</td>
358
 
</tr>
359
 
<tr>
360
 
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
361
 
<td> pointer to a connection object used by <em class="parameter"><code>impl</code></em> to track.
362
 
state (the exact nature of <em class="parameter"><code>connection</code></em> varies from implementation to
363
 
implementation).
364
 
</td>
365
 
</tr>
366
 
<tr>
367
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
368
 
<td> a newly created socket.
369
 
</td>
370
 
</tr>
371
 
</tbody>
372
 
</table></div>
373
 
</div>
374
 
<hr>
375
 
<div class="refsect2" lang="en">
376
 
<a name="gnome-vfs-socket-write"></a><h3>gnome_vfs_socket_write ()</h3>
377
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      gnome_vfs_socket_write              (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
378
 
                                                         gconstpointer buffer,
379
 
                                                         int bytes,
380
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_written,
381
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
382
 
<p>
383
 
Write <em class="parameter"><code>bytes</code></em> bytes of data from <em class="parameter"><code>buffer</code></em> to <em class="parameter"><code>socket</code></em>.</p>
384
 
<p>
385
 
</p>
386
 
<div class="variablelist"><table border="0">
387
 
<col align="left" valign="top">
388
 
<tbody>
389
 
<tr>
390
 
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
391
 
<td> socket to write data to.
392
 
</td>
393
 
</tr>
394
 
<tr>
395
 
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
396
 
<td> data to write to the socket.
397
 
</td>
398
 
</tr>
399
 
<tr>
400
 
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
401
 
<td> number of bytes from <em class="parameter"><code>buffer</code></em> to write to <em class="parameter"><code>socket</code></em>.
402
 
</td>
403
 
</tr>
404
 
<tr>
405
 
<td><p><span class="term"><em class="parameter"><code>bytes_written</code></em> :</span></p></td>
406
 
<td> pointer to a <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize"><span class="type">GnomeVFSFileSize</span></a>, will contain
407
 
the number of bytes actually written to the <em class="parameter"><code>socket</code></em> on return.
408
 
</td>
409
 
</tr>
410
 
<tr>
411
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
412
 
<td> optional cancellation object.
413
 
</td>
414
 
</tr>
415
 
<tr>
416
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
417
 
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
418
 
</td>
419
 
</tr>
420
 
</tbody>
421
 
</table></div>
422
 
</div>
423
 
<hr>
424
 
<div class="refsect2" lang="en">
425
 
<a name="gnome-vfs-socket-close"></a><h3>gnome_vfs_socket_close ()</h3>
426
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      gnome_vfs_socket_close              (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
427
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
428
 
<p>
429
 
Close <em class="parameter"><code>socket</code></em>, freeing any resources it may be using.</p>
430
 
<p>
431
 
</p>
432
 
<div class="variablelist"><table border="0">
433
 
<col align="left" valign="top">
434
 
<tbody>
435
 
<tr>
436
 
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
437
 
<td> the socket to be closed.
438
 
</td>
439
 
</tr>
440
 
<tr>
441
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
442
 
<td> optional cancellation object.
443
 
</td>
444
 
</tr>
445
 
<tr>
446
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
447
 
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
448
 
</td>
449
 
</tr>
450
 
</tbody>
451
 
</table></div>
452
 
</div>
453
 
<hr>
454
 
<div class="refsect2" lang="en">
455
 
<a name="gnome-vfs-socket-read"></a><h3>gnome_vfs_socket_read ()</h3>
456
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      gnome_vfs_socket_read               (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
457
 
                                                         gpointer buffer,
458
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> bytes,
459
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize">GnomeVFSFileSize</a> *bytes_read,
460
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
461
 
<p>
462
 
Read <em class="parameter"><code>bytes</code></em> bytes of data from the <em class="parameter"><code>socket</code></em> into <em class="parameter"><code>buffer</code></em>.</p>
463
 
<p>
464
 
</p>
465
 
<div class="variablelist"><table border="0">
466
 
<col align="left" valign="top">
467
 
<tbody>
468
 
<tr>
469
 
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
470
 
<td> socket to read data from.
471
 
</td>
472
 
</tr>
473
 
<tr>
474
 
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
475
 
<td> allocated buffer of at least <em class="parameter"><code>bytes</code></em> bytes to be read into.
476
 
</td>
477
 
</tr>
478
 
<tr>
479
 
<td><p><span class="term"><em class="parameter"><code>bytes</code></em> :</span></p></td>
480
 
<td> number of bytes to read from <em class="parameter"><code>socket</code></em> into <em class="parameter"><code>buffer</code></em>.
481
 
</td>
482
 
</tr>
483
 
<tr>
484
 
<td><p><span class="term"><em class="parameter"><code>bytes_read</code></em> :</span></p></td>
485
 
<td> pointer to a <a class="link" href="gnome-vfs-20-gnome-vfs-file-size.html#GnomeVFSFileSize" title="GnomeVFSFileSize"><span class="type">GnomeVFSFileSize</span></a>, will contain
486
 
the number of bytes actually read from the socket on return.
487
 
</td>
488
 
</tr>
489
 
<tr>
490
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
491
 
<td> optional cancellation object.
492
 
</td>
493
 
</tr>
494
 
<tr>
495
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
496
 
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
497
 
</td>
498
 
</tr>
499
 
</tbody>
500
 
</table></div>
501
 
</div>
502
 
<hr>
503
 
<div class="refsect2" lang="en">
504
 
<a name="gnome-vfs-socket-free"></a><h3>gnome_vfs_socket_free ()</h3>
505
 
<pre class="programlisting">void                gnome_vfs_socket_free               (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket);</pre>
506
 
<p>
507
 
Frees the memory allocated for <em class="parameter"><code>socket</code></em>, but does
508
 
not call any <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocketImpl" title="GnomeVFSSocketImpl"><span class="type">GnomeVFSSocketImpl</span></a> function.</p>
509
 
<p>
510
 
</p>
511
 
<div class="variablelist"><table border="0">
512
 
<col align="left" valign="top">
513
 
<tbody><tr>
514
 
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
515
 
<td> The <a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket"><span class="type">GnomeVFSSocket</span></a> you want to free. 
516
 
</td>
517
 
</tr></tbody>
518
 
</table></div>
519
 
<p class="since">Since 2.8</p>
520
 
</div>
521
 
<hr>
522
 
<div class="refsect2" lang="en">
523
 
<a name="gnome-vfs-socket-set-timeout"></a><h3>gnome_vfs_socket_set_timeout ()</h3>
524
 
<pre class="programlisting"><a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a>      gnome_vfs_socket_set_timeout        (<a class="link" href="gnome-vfs-20-gnome-vfs-socket.html#GnomeVFSSocket" title="GnomeVFSSocket">GnomeVFSSocket</a> *socket,
525
 
                                                         GTimeVal *timeout,
526
 
                                                         <a class="link" href="gnome-vfs-20-gnome-vfs-async-ops.html#GnomeVFSCancellation" title="GnomeVFSCancellation">GnomeVFSCancellation</a> *cancellation);</pre>
527
 
<p>
528
 
Set a timeout of <em class="parameter"><code>timeout</code></em>. If <em class="parameter"><code>timeout</code></em> is <code class="literal">NULL</code>, following operations
529
 
will block indefinitely).
530
 
</p>
531
 
<p>
532
 
Note if you set <em class="parameter"><code>timeout</code></em> to 0 (means tv_sec and tv_usec are both 0)
533
 
every following operation will return immediately. (This can be used
534
 
for polling.)</p>
535
 
<p>
536
 
</p>
537
 
<div class="variablelist"><table border="0">
538
 
<col align="left" valign="top">
539
 
<tbody>
540
 
<tr>
541
 
<td><p><span class="term"><em class="parameter"><code>socket</code></em> :</span></p></td>
542
 
<td> socket to set the timeout of.
543
 
</td>
544
 
</tr>
545
 
<tr>
546
 
<td><p><span class="term"><em class="parameter"><code>timeout</code></em> :</span></p></td>
547
 
<td> the timeout.
548
 
</td>
549
 
</tr>
550
 
<tr>
551
 
<td><p><span class="term"><em class="parameter"><code>cancellation</code></em> :</span></p></td>
552
 
<td> optional cancellation object.
553
 
</td>
554
 
</tr>
555
 
<tr>
556
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
557
 
<td> <a class="link" href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult"><span class="type">GnomeVFSResult</span></a> indicating the success of the operation.
558
 
 
559
 
</td>
560
 
</tr>
561
 
</tbody>
562
 
</table></div>
563
 
<p class="since">Since 2.8</p>
564
 
</div>
565
 
</div>
566
 
</div>
567
 
<div class="footer">
568
 
<hr>
569
 
          Generated by GTK-Doc V1.11</div>
570
 
</body>
571
 
</html>