aboutsummaryrefslogtreecommitdiffstats
path: root/pages/develop/api/efl/net/socket/simple.txt
blob: 7b3c3d44373dda9d100dbfcfd4d84abc8f31c3e3 (plain) (blame)
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
~~Title: Efl.Net.Socket.Simple~~
====== Efl.Net.Socket.Simple (class) ======

===== Description =====

%%A wrapper socket offering an easy to use, buffered I/O.%%

%%The simple socket encapsulates an actual %%[[:develop:api:efl:net:socket|Efl.Net.Socket]]%%, and uses it with an %%[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]%%, which creates an input %%[[:develop:api:efl:io:queue|Efl.Io.Queue]]%%, an output %%[[:develop:api:efl:io:queue|Efl.Io.Queue]]%% and these are linked using a receiver and a sender %%[[:develop:api:efl:io:copier|Efl.Io.Copier]]%%.%%

%%The idea is that unlike traditional %%[[:develop:api:efl:net:socket|Efl.Net.Socket]]%% that will attempt to write directly to socket and thus may take less data than requested, this one will keep the pending data in its own buffer, feeding to the actual socket when it %%[[:develop:api:efl:io:writer:property:can_write|Efl.Io.Writer.can_write]]%%. That makes its operation much simpler as %%[[:develop:api:efl:io:writer:method:write|Efl.Io.Writer.write]]%% will always take the full data -- allows "write and forget", if unlimited (see %%[[:develop:api:efl:io:buffered_stream:property:max_queue_size_output|Efl.Io.Buffered_Stream.max_queue_size_output]]%%).%%

%%Reading is also much simpler since received data is kept in an %%[[:develop:api:efl:io:queue|Efl.Io.Queue]]%%, thus its size can be queried with %%[[:develop:api:efl:io:buffered_stream:property:pending_read|Efl.Io.Buffered_Stream.pending_read]]%% and read with %%[[:develop:api:efl:io:reader:method:read|Efl.Io.Reader.read]]%% or peeked with %%[[:develop:api:efl:io:buffered_stream:property:slice|Efl.Io.Buffered_Stream.slice]]%%, then discarded with %%[[:develop:api:efl:io:buffered_stream:method:discard|Efl.Io.Buffered_Stream.discard]]%% or %%[[:develop:api:efl:io:buffered_stream:method:clear|Efl.Io.Buffered_Stream.clear]]%%.%%

%%Then when waiting for a complete message, just peek at its contents, if not complete do nothing, if complete then either %%[[:develop:api:efl:io:reader:method:read|Efl.Io.Reader.read]]%% to get a copy or manipulate a read-only reference from %%[[:develop:api:efl:io:buffered_stream:property:slice|Efl.Io.Buffered_Stream.slice]]%% and then %%[[:develop:api:efl:io:buffered_stream:method:discard|Efl.Io.Buffered_Stream.discard]]%%%%

%%The actual socket is set with the constructor method %%[[:develop:api:efl:io:buffered_stream:property:inner_io|Efl.Io.Buffered_Stream.inner_io.set]]%% and can be retrieved with %%[[:develop:api:efl:io:buffered_stream:property:inner_io|Efl.Io.Buffered_Stream.inner_io.get]]%%, which should be used with care.%%

//Since 1.19//

{{page>:develop:api-include:efl:net:socket:simple:description&nouser&nolink&nodate}}

===== Inheritance =====

 => [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]] //(class)// => [[:develop:api:efl:loop_user|Efl.Loop_User]] //(class)// => [[:develop:api:efl:object|Efl.Object]] //(class)//
++++ Inheritance graph |

<graphviz>
digraph hierarchy {
    bgcolor = "transparent"
    size = "6"
    rankdir = "TB"

    node [shape = "box"]
    edge [color = "gray35"]

    efl_net_socket_simple [fillcolor = "black", label = "Efl.Net.Socket.Simple", color = "gray15", fontcolor = "white", style = "filled"]
    efl_io_buffered_stream [fillcolor = "gray15", label = "Efl.Io.Buffered_Stream", color = "gray15", fontcolor = "white", style = "filled"]
    efl_loop_user [fillcolor = "gray15", label = "Efl.Loop_User", color = "gray15", fontcolor = "white", style = "filled"]
    efl_object [fillcolor = "gray15", label = "Efl.Object", color = "gray15", fontcolor = "white", style = "filled"]
    efl_io_reader [fillcolor = "gray15", label = "Efl.Io.Reader", color = "cornflowerblue", fontcolor = "white", style = "filled"]
    efl_io_writer [fillcolor = "gray15", label = "Efl.Io.Writer", color = "cornflowerblue", fontcolor = "white", style = "filled"]
    efl_io_closer [fillcolor = "gray15", label = "Efl.Io.Closer", color = "deepskyblue", fontcolor = "white", style = "filled"]
    efl_net_socket [fillcolor = "gray15", label = "Efl.Net.Socket", color = "cornflowerblue", fontcolor = "white", style = "filled"]
    efl_io_reader [fillcolor = "gray15", label = "Efl.Io.Reader", color = "cornflowerblue", fontcolor = "white", style = "filled"]
    efl_io_writer [fillcolor = "gray15", label = "Efl.Io.Writer", color = "cornflowerblue", fontcolor = "white", style = "filled"]
    efl_io_closer [fillcolor = "gray15", label = "Efl.Io.Closer", color = "deepskyblue", fontcolor = "white", style = "filled"]

    efl_net_socket_simple -> efl_io_buffered_stream
    efl_io_buffered_stream -> efl_loop_user
    efl_loop_user -> efl_object
    efl_io_buffered_stream -> efl_io_reader
    efl_io_buffered_stream -> efl_io_writer
    efl_io_buffered_stream -> efl_io_closer
    efl_net_socket_simple -> efl_net_socket
    efl_net_socket -> efl_io_reader
    efl_net_socket -> efl_io_writer
    efl_net_socket -> efl_io_closer
}
</graphviz>

++++

++++ Full hierarchy |

  * [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]] //(class)//
    * [[:develop:api:efl:loop_user|Efl.Loop_User]] //(class)//
      * [[:develop:api:efl:object|Efl.Object]] //(class)//
    * [[:develop:api:efl:io:reader|Efl.Io.Reader]] //(interface)//
    * [[:develop:api:efl:io:writer|Efl.Io.Writer]] //(interface)//
    * [[:develop:api:efl:io:closer|Efl.Io.Closer]] //(mixin)//
  * [[:develop:api:efl:net:socket|Efl.Net.Socket]] //(interface)//
    * [[:develop:api:efl:io:reader|Efl.Io.Reader]] //(interface)//
    * [[:develop:api:efl:io:writer|Efl.Io.Writer]] //(interface)//
    * [[:develop:api:efl:io:closer|Efl.Io.Closer]] //(mixin)//


++++
===== Members =====

==== Inherited ====

[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:method:clear|clear]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:method:discard|discard]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:method:eos_mark|eos_mark]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:method:flush|flush]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:line_delimiter|line_delimiter]]** //**(get, set)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:max_queue_size_input|max_queue_size_input]]** //**(get, set)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:max_queue_size_output|max_queue_size_output]]** //**(get, set)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:pending_read|pending_read]]** //**(get)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:pending_write|pending_write]]** //**(get)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:progress|progress]]** //**(get)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:read_chunk_size|read_chunk_size]]** //**(get, set)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:slice|slice]]** //**(get)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:property:timeout_inactivity|timeout_inactivity]]** //**(get, set)**//
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:net:socket:simple:property:inner_io|inner_io]]** //**(get, set)**// //[Overridden here]//
\\ 
[[:develop:api:efl:io:closer|Efl.Io.Closer]].**[[:develop:api:efl:io:buffered_stream:method:close|close]]** //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:io:closer|Efl.Io.Closer]].**[[:develop:api:efl:io:buffered_stream:property:close_on_destructor|close_on_destructor]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:io:closer|Efl.Io.Closer]].**[[:develop:api:efl:io:buffered_stream:property:close_on_exec|close_on_exec]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:io:closer|Efl.Io.Closer]].**[[:develop:api:efl:io:buffered_stream:property:closed|closed]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:io:reader|Efl.Io.Reader]].**[[:develop:api:efl:io:buffered_stream:method:read|read]]** //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:io:reader|Efl.Io.Reader]].**[[:develop:api:efl:io:buffered_stream:property:can_read|can_read]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]// ''protected set''
\\ 
[[:develop:api:efl:io:reader|Efl.Io.Reader]].**[[:develop:api:efl:io:buffered_stream:property:eos|eos]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]// ''protected set''
\\ 
[[:develop:api:efl:io:writer|Efl.Io.Writer]].**[[:develop:api:efl:io:buffered_stream:method:write|write]]** //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:io:writer|Efl.Io.Writer]].**[[:develop:api:efl:io:buffered_stream:property:can_write|can_write]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]// ''protected set''
\\ 
[[:develop:api:efl:loop_user|Efl.Loop_User]].**[[:develop:api:efl:loop_user:property:loop|loop]]** //**(get)**//
\\ 
[[:develop:api:efl:net:socket|Efl.Net.Socket]].**[[:develop:api:efl:net:socket:simple:property:address_local|address_local]]** //**(get, set)**// //[Overridden here]// ''protected set''
\\ 
[[:develop:api:efl:net:socket|Efl.Net.Socket]].**[[:develop:api:efl:net:socket:simple:property:address_remote|address_remote]]** //**(get, set)**// //[Overridden here]// ''protected set''
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:io:buffered_stream:method:destructor|destructor]]** //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:io:buffered_stream:method:finalize|finalize]]** //[Overridden in [[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]]]//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:loop_user:property:parent|parent]]** //**(get, set)**// //[Overridden in [[:develop:api:efl:loop_user|Efl.Loop_User]]]//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:children_iterator_new|children_iterator_new]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:composite_attach|composite_attach]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:composite_detach|composite_detach]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:composite_part_is|composite_part_is]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:constructor|constructor]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:debug_name_override|debug_name_override]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:del|del]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_callback_forwarder_add|event_callback_forwarder_add]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_callback_forwarder_del|event_callback_forwarder_del]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_callback_stop|event_callback_stop]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_freeze|event_freeze]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_global_freeze|event_global_freeze]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_global_thaw|event_global_thaw]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:event_thaw|event_thaw]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:name_find|name_find]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:method:provider_find|provider_find]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:property:allow_parent_unref|allow_parent_unref]]** //**(get, set)**//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:property:comment|comment]]** //**(get, set)**//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:property:event_freeze_count|event_freeze_count]]** //**(get)**//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:property:event_global_freeze_count|event_global_freeze_count]]** //**(get)**//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:property:finalized|finalized]]** //**(get)**//
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:property:name|name]]** //**(get, set)**//
\\ 

===== Events =====

==== Inherited ====

[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:error|error]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:finished|finished]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:line|line]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:progress|progress]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:read_finished|read,finished]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:slice_changed|slice,changed]]**
\\ 
[[:develop:api:efl:io:buffered_stream|Efl.Io.Buffered_Stream]].**[[:develop:api:efl:io:buffered_stream:event:write_finished|write,finished]]**
\\ 
[[:develop:api:efl:io:closer|Efl.Io.Closer]].**[[:develop:api:efl:io:closer:event:closed|closed]]**
\\ 
[[:develop:api:efl:io:reader|Efl.Io.Reader]].**[[:develop:api:efl:io:reader:event:can_read_changed|can_read,changed]]**
\\ 
[[:develop:api:efl:io:reader|Efl.Io.Reader]].**[[:develop:api:efl:io:reader:event:eos|eos]]**
\\ 
[[:develop:api:efl:io:writer|Efl.Io.Writer]].**[[:develop:api:efl:io:writer:event:can_write_changed|can_write,changed]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:event:callback_add|callback,add]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:event:callback_del|callback,del]]**
\\ 
[[:develop:api:efl:object|Efl.Object]].**[[:develop:api:efl:object:event:del|del]]**
\\