2019-02-14 08:37:02 -08:00
|
|
|
class @beta Efl.Net.Dialer_Simple extends Efl.Net.Socket_Simple implements Efl.Net.Dialer {
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
[[Connects to a remote server offering an easy to use, buffered I/O.
|
|
|
|
|
2018-04-13 01:58:29 -07:00
|
|
|
The simple dialer is based on @Efl.Net.Socket_Simple, which
|
2017-12-20 09:30:29 -08:00
|
|
|
encapsulates an actual @Efl.Net.Socket and uses it with an
|
|
|
|
@Efl.Io.Buffered_Stream. This creates an input @Efl.Io.Queue,
|
|
|
|
an output @Efl.Io.Queue. Both of these are linked using a receiver
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
and a sender @Efl.Io.Copier.
|
|
|
|
|
2017-12-20 09:30:29 -08:00
|
|
|
The idea is that unlike the traditional @Efl.Net.Socket which
|
|
|
|
attempts to write directly to the socket and thus may take less data
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
than requested, this one will keep the pending data in its own
|
2017-12-20 09:30:29 -08:00
|
|
|
buffer, feeding it to the actual socket when
|
|
|
|
@Efl.Io.Writer.can_write occurs. This makes its operation much simpler
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
as @Efl.Io.Writer.write will always take the full data -- allows
|
|
|
|
"write and forget", if unlimited (see
|
|
|
|
@Efl.Io.Buffered_Stream.max_queue_size_output).
|
|
|
|
|
|
|
|
Reading is also much simpler since received data is kept in an
|
|
|
|
@Efl.Io.Queue, thus its size can be queried with
|
|
|
|
@Efl.Io.Buffered_Stream.pending_read and read with
|
|
|
|
@Efl.Io.Reader.read or peeked with
|
2016-12-19 08:46:37 -08:00
|
|
|
@Efl.Io.Buffered_Stream.slice, then discarded with
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
@Efl.Io.Buffered_Stream.discard or
|
|
|
|
@Efl.Io.Buffered_Stream.clear.
|
|
|
|
|
2017-12-20 09:30:29 -08:00
|
|
|
When waiting for a complete message, you can then just peek at its
|
|
|
|
contents. If it's incomplete do nothing, if complete then either
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
@Efl.Io.Reader.read to get a copy or manipulate a read-only
|
2016-12-19 08:46:37 -08:00
|
|
|
reference from @Efl.Io.Buffered_Stream.slice and then
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
@Efl.Io.Buffered_Stream.discard
|
|
|
|
|
|
|
|
The actual dialer is created using the class given as the
|
|
|
|
constructor property @.inner_class and can be retrieved with
|
2017-12-20 09:30:29 -08:00
|
|
|
@Efl.Io.Buffered_Stream.inner_io. This should be used with
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
care, like extra configuration before @Efl.Net.Dialer.dial is
|
|
|
|
called.
|
|
|
|
|
|
|
|
If your object class requires some constructor-only properties
|
|
|
|
to be set prior to @Efl.Object.finalize, then use
|
|
|
|
@Efl.Io.Buffered_Stream.inner_io directly providing an already
|
|
|
|
created dialer.
|
|
|
|
]]
|
|
|
|
|
|
|
|
methods {
|
|
|
|
@property inner_class {
|
|
|
|
[[The class used to create @Efl.Io.Buffered_Stream.inner_io if none was provided.
|
|
|
|
|
|
|
|
This class could be set at construction time and will be
|
|
|
|
used to create the inner socket during
|
|
|
|
@Efl.Object.finalize.
|
|
|
|
|
|
|
|
It is a helper for users, removing the burden to
|
|
|
|
manually create and specify a dialer object.
|
|
|
|
]]
|
|
|
|
get {
|
|
|
|
[[The internal class used to create the inner dialer.]]
|
|
|
|
}
|
|
|
|
set {
|
|
|
|
[[Constructor-only property to define the class used to create the inner dialer.]]
|
|
|
|
}
|
|
|
|
values {
|
|
|
|
klass: const(Efl.Class); [[The class]]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
implements {
|
|
|
|
Efl.Object.finalize;
|
2018-04-17 16:17:29 -07:00
|
|
|
Efl.Object.invalidate;
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
Efl.Object.destructor;
|
2016-12-27 07:58:07 -08:00
|
|
|
Efl.Io.Buffered_Stream.inner_io { set; }
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
Efl.Net.Dialer.dial;
|
2016-12-27 07:58:07 -08:00
|
|
|
Efl.Net.Dialer.address_dial { get; }
|
|
|
|
Efl.Net.Dialer.connected { get; }
|
2017-01-11 07:35:03 -08:00
|
|
|
Efl.Net.Dialer.proxy { get; set; }
|
|
|
|
Efl.Net.Dialer.timeout_dial { get; set; }
|
|
|
|
Efl.Io.Buffered_Stream.timeout_inactivity { get; set; }
|
|
|
|
Efl.Io.Buffered_Stream.max_queue_size_input { get; set; }
|
|
|
|
Efl.Io.Buffered_Stream.max_queue_size_output { get; set; }
|
|
|
|
Efl.Io.Buffered_Stream.read_chunk_size { get; set; }
|
|
|
|
Efl.Io.Buffered_Stream.line_delimiter { get; set; }
|
efl_net_{socket,dialer,server}_simple: easy to use, buffered network sockets.
The low level I/O primitives are powerful but adds some complexity to
use, for bi-directional streaming communication one ends creating two
Efl.Io.Queue and two Efl.Io.Copier to pipe data to socket when it can
operate.
Then encapsulate the socket using the new Efl.Io.Buffered_Stream, this
will allow the socket, be a dialer or a server client, to be operated
as a single handle that internally carries about the buffering for
you.
As one can see in the examples, compared to their "manual"
alternatives they are very easy to use, ressembling
Ecore_Con_Server/Ecore_Con_Client, but also offers line-based
delimiters and the possibility to let the socket to handle queueing
for you in case you received partial messages (just do not
read/clear/discard the received data).
2016-11-25 11:18:34 -08:00
|
|
|
}
|
|
|
|
}
|