Ntk.Lib.TaskletUtils
Description:
This module allows the developer to use sockets API with a blocking-like style and makes sure that only the intended tasklet becomes
blocked, not the whole application.
Content:
Interfaces:
- IConnectedStreamSocket -
When you have a socket connected to a server, or when you receive a connection, you get an obscure object
that implements this API.
Classes:
- ServerStreamSocket - Use this
class to implement a TCP connection oriented service. In particular, you can wait for a connection without blocking the rest of the
application.
- ClientStreamSocket - Use this
class to make a connection to a TCP service. In particular, you can wait for the connect to complete without blocking the rest of the
application.
- ServerDatagramSocket - Use
this class to implement a UDP datagram oriented service. The call to recvfrom blocks only the current tasklet, not the whole
application. You can use this same object to send a response to the caller. Or else handle the request on another tasklet and, when
necessary, use an BroadcastClientDatagramSocket to send a reply.
- BroadcastClientDatagramSocket -
Use this class to send a single UDP datagram in broadcast over a particular interface.
Functions:
- public
string
s_addr_to_string (string
family, uint32
s_addr)
Emulate inet_ntop and pton. In python we have: | >>>
socket.inet_ntop(socket.AF_INET,'1234') | '49.50.51.52' | >>> socket.inet_pton(socket.AF_INET,'49.50.51.52') | '1234' These
emulation will work only with IPV4. For now this is not a problem because IPV6 is currently disabled.
- public
uint32
string_to_s_addr (string
family, string
dotted)
- public
string
pip_to_dotted (string
family, uchar
[] pip)
- public
uchar
[] dotted_to_pip (string
family, string
dotted)