-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathNetwork--DirectConnection.html
359 lines (300 loc) · 11.9 KB
/
Network--DirectConnection.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Network::DirectConnection - Connection handling : OpenKore source code documentation</title>
<link rel="stylesheet" type="text/css" href="openkore.css">
<link rel="stylesheet" type="text/css" href="highlight.css">
<!-- Fix broken PNG transparency for IE/Win5-6+ -->
<!--[if gte IE 5.5000]>
<script type="text/javascript" src="pngfix.js"></script>
<![endif]-->
</head>
<body>
<div id="title">OpenKore source code documentation</div>
<div id="navigation">
<ul>
<li><a href="http://www.openkore.com/">Main website</a></li>
<li><a href="index.html">Table of contents</a></li>
<li><b>Network::DirectConnection</b></li>
</ul>
</div>
<div id="main">
<h1>Network::DirectConnection - Connection handling</h1>
The Network module handles connections to the Ragnarok Online server.
This module only handles connection issues, and nothing else. It doesn't do
anything with the actual data. Network data handling is performed by
the <a href="Network--Receive.html"><code>Network::Receive</code></a> and Network::Receive::ServerTypeX classes.
<p>
The submodule <a href="Network--Send.html"><code>Network::Send</code></a> contains functions for sending all
kinds of messages to the RO server.
<p>
Please also read <a href="http://wiki.openkore.com/index.php/Network_subsystem">the
network subsystem overview.</a>
<p>
This implementation establishes a direct connection to the RO server.
Note that there are alternative implementations for this interface: <a href="Network--XKore.html"><code>Network::XKore</code></a>,
<a href="Network--XKore2.html"><code>Network::XKore2</code></a> and <a href="Network--XKoreProxy.html"><code>Network::XKoreProxy</code></a>
<p><table class="functionIndex">
<tr><th colspan="3">Functions in this module</th></tr><tr onclick="location.href='#Network::DirectConnection->new';">
<td class="return-type"></td>
<td class="func"><a href="#Network::DirectConnection->new">Network::DirectConnection->new</a></td>
<td class="decl">([wrapper])</td>
</tr><tr onclick="location.href='#$net->checkConnection';">
<td class="return-type"></td>
<td class="func"><a href="#$net->checkConnection">$net->checkConnection</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->clientAlive';">
<td class="return-type">boolean</td>
<td class="func"><a href="#$net->clientAlive">$net->clientAlive</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->clientRecv';">
<td class="return-type">Bytes</td>
<td class="func"><a href="#$net->clientRecv">$net->clientRecv</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->clientSend';">
<td class="return-type"></td>
<td class="func"><a href="#$net->clientSend">$net->clientSend</a></td>
<td class="decl">(<span class="type">Bytes</span> data)</td>
</tr><tr onclick="location.href='#$net->serverAddress';">
<td class="return-type">Bytes</td>
<td class="func"><a href="#$net->serverAddress">$net->serverAddress</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->serverAliveServer';">
<td class="return-type">boolean</td>
<td class="func"><a href="#$net->serverAliveServer">$net->serverAliveServer</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->serverConnect';">
<td class="return-type"></td>
<td class="func"><a href="#$net->serverConnect">$net->serverConnect</a></td>
<td class="decl">(<span class="type">String</span> host, int port)</td>
</tr><tr onclick="location.href='#$net->serverDisconnect';">
<td class="return-type"></td>
<td class="func"><a href="#$net->serverDisconnect">$net->serverDisconnect</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->serverPeerHost';">
<td class="return-type">String</td>
<td class="func"><a href="#$net->serverPeerHost">$net->serverPeerHost</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->serverPeerPort';">
<td class="return-type">int</td>
<td class="func"><a href="#$net->serverPeerPort">$net->serverPeerPort</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->serverRecv';">
<td class="return-type">Bytes</td>
<td class="func"><a href="#$net->serverRecv">$net->serverRecv</a></td>
<td class="decl">()</td>
</tr><tr onclick="location.href='#$net->serverSend';">
<td class="return-type">void</td>
<td class="func"><a href="#$net->serverSend">$net->serverSend</a></td>
<td class="decl">(<span class="type">Bytes</span> data)</td>
</tr><tr onclick="location.href='#$net->version';">
<td class="return-type">int</td>
<td class="func"><a href="#$net->version">$net->version</a></td>
<td class="decl">()</td>
</tr>
</table>
<p><hr class="details_sep">
<h2>Details</h2>
<div class="details">
<p>
<div class="function"><a name="$net->checkConnection"></a>
<h3>$net->checkConnection</h3>
<dl>
<dt class="decl">
<span class="return-type"> </span><strong>$net->checkConnection</strong>()
</dt>
<dd>
<div class="desc">Handles any connection issues. Based on the current situation, this function may
re-connect to the RO server, disconnect, do nothing, etc.
<p>
This function is meant to be run in the Kore main loop.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->clientAlive"></a>
<h3>$net->clientAlive</h3>
<dl>
<dt class="decl">
<span class="return-type"> boolean</span> <strong>$net->clientAlive</strong>()
</dt>
<dd>
<div class="desc">Check whether there are one or more clients connected to Kore.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->clientRecv"></a>
<h3>$net->clientRecv</h3>
<dl>
<dt class="decl">
<span class="return-type"> Bytes</span> <strong>$net->clientRecv</strong>()
</dt>
<dd>
<div class="desc">Receive data that the RO client wants to send to the RO server.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->clientSend"></a>
<h3>$net->clientSend</h3>
<dl>
<dt class="decl">
<span class="return-type"> </span><strong>$net->clientSend</strong>(<span class="type">Bytes</span> data)
</dt>
<dd>
<div class="desc">Make the RO client think that it has received <code>$data</code>.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverAddress"></a>
<h3>$net->serverAddress</h3>
<dl>
<dt class="decl">
<span class="return-type"> Bytes</span> <strong>$net->serverAddress</strong>()
</dt>
<dd>
<div class="desc">Return the server's raw address.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverAliveServer"></a>
<h3>$net->serverAliveServer</h3>
<dl>
<dt class="decl">
<span class="return-type"> boolean</span> <strong>$net->serverAliveServer</strong>()
</dt>
<dd>
<div class="desc">Check whether the connection to the server is alive.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverConnect"></a>
<h3>$net->serverConnect</h3>
<dl>
<dt class="decl">
<span class="return-type"> </span><strong>$net->serverConnect</strong>(<span class="type">String</span> host, int port)
</dt>
<dd>
<dl class="params_and_returns">
<dt class="params"><strong>Parameters:</strong></dt>
<dd class="param"><code>host</code> : the host name/IP of the RO server to connect to.</dd>
<dd class="param"><code>port</code> : the port number of the RO server to connect to.</dd>
</dl><p>
<div class="desc">Establish a connection to a Ragnarok Online server.
<p>
This function is used internally by <a href="Network--XKore.html#$net->checkConnection"><code>$net->checkConnection()</code></a> and should not be used directly.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverDisconnect"></a>
<h3>$net->serverDisconnect</h3>
<dl>
<dt class="decl">
<span class="return-type"> </span><strong>$net->serverDisconnect</strong>()
</dt>
<dd>
<div class="desc">Disconnect from the current Ragnarok Online server.
<p>
This function is used internally by <a href="Network--XKore.html#$net->checkConnection"><code>$net->checkConnection()</code></a> and should not be used directly.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverPeerHost"></a>
<h3>$net->serverPeerHost</h3>
<dl>
<dt class="decl">
<span class="return-type"> String</span> <strong>$net->serverPeerHost</strong>()
</dt>
<dd>
<div class="desc">If the connection to the server is alive, returns the host name of the server.
Otherwise, returns undef.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverPeerPort"></a>
<h3>$net->serverPeerPort</h3>
<dl>
<dt class="decl">
<span class="return-type"> int</span> <strong>$net->serverPeerPort</strong>()
</dt>
<dd>
<div class="desc">If the connection to the server is alive, returns the port number of the server.
Otherwise, returns undef.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverRecv"></a>
<h3>$net->serverRecv</h3>
<dl>
<dt class="decl">
<span class="return-type"> Bytes</span> <strong>$net->serverRecv</strong>()
</dt>
<dd>
<div class="desc">Receive data from the RO server.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->serverSend"></a>
<h3>$net->serverSend</h3>
<dl>
<dt class="decl">
<span class="return-type"> void</span> <strong>$net->serverSend</strong>(<span class="type">Bytes</span> data)
</dt>
<dd>
<div class="desc">If the connection to the server is alive, send data to the server.
Otherwise, this method does nothing.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="$net->version"></a>
<h3>$net->version</h3>
<dl>
<dt class="decl">
<span class="return-type"> int</span> <strong>$net->version</strong>()
</dt>
<dd>
<div class="desc">Returns the implementation number this object.</div>
</dd>
</dl>
</div>
<p><hr class="function_sep"><p>
<div class="function"><a name="Network::DirectConnection->new"></a>
<h3>Network::DirectConnection->new</h3>
<dl>
<dt class="decl">
<span class="return-type"> </span><strong>Network::DirectConnection->new</strong>([wrapper])
</dt>
<dd>
<dl class="params_and_returns">
<dt class="params"><strong>Parameters:</strong></dt>
<dd class="param"><code>wrapper</code> : If this object is to be wrapped by another object which is interface-compatible</dd>
<dd class="param"><code> with the Network</code> : :DirectConnection class, then specify the wrapper object here. The message sender will use this wrapper to send socket data. Internally, the reference to the wrapper will be stored as a weak reference.</dd>
</dl><p>
<div class="desc">Create a new Network::DirectConnection object. The connection is not yet established.</div>
</dd>
</dl>
</div>
</div>
<p><hr><p>
<div id="footer">
<ul>
<li><a href="http://validator.w3.org/check?uri=referer" title="Valid HTML 4.01!"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"></a></li>
<li><a href="http://www.mozilla.com/" title="Get Firefox - Take Back the Web"><img width="104" height="32" src="http://www.mozilla.org/products/firefox/buttons/getfirefox_small.png" alt="Get Firefox - Take Back the Web"></a></li>
<li><a href="http://www.mozilla.com/" title="If you were looking at this page in any browser but Microsoft Internet Explorer, it would look and run better and faster"><img width="45" height="45" src="http://linuxart.com/img/noIE-small.png" alt="If you were looking at this page in any browser but Microsoft Internet Explorer, it would look and run better and faster"></a></li>
</ul>
Last modified: Fri Nov 16 10:05:11 2012
</div>
</div>
</body>
</html>