![]() |
![]() |
![]() |
libinfinity-0.5 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
enum InfdTcpServerStatus; InfdTcpServer; struct InfdTcpServerClass; gboolean infd_tcp_server_bind (InfdTcpServer *server
,GError **error
); gboolean infd_tcp_server_open (InfdTcpServer *server
,GError **error
); void infd_tcp_server_close (InfdTcpServer *server
);
"io" InfIo* : Read / Write / Construct Only "local-address" InfIpAddress* : Read / Write "local-port" guint : Read / Write "status" InfdTcpServerStatus : Read
typedef enum { INFD_TCP_SERVER_CLOSED, INFD_TCP_SERVER_BOUND, INFD_TCP_SERVER_OPEN } InfdTcpServerStatus;
struct InfdTcpServerClass { GObjectClass parent_class; /* Signals */ void (*new_connection)(InfdTcpServer* server, InfTcpConnection* connection); void (*error)(InfdTcpServer* server, GError* error); };
gboolean infd_tcp_server_bind (InfdTcpServer *server
,GError **error
);
Binds the server to the address and port given by the
"local-address" and "local-port" properties. If
the former is NULL
, it will bind on all interfaces on IPv4. If the latter
is 0, a random available port will be assigned. If the function fails,
FALSE
is returned and an error is set.
server
must be in INFD_TCP_SERVER_CLOSED
state for this function to be
called.
|
A InfdTcpServer. |
|
Location to store error information, if any. |
Returns : |
TRUE on success, or FALSE if an error occured. |
gboolean infd_tcp_server_open (InfdTcpServer *server
,GError **error
);
Attempts to open server
. This means binding its local address and port
if not already (see infd_tcp_server_bind()
) and accepting incoming
connections.
server
needs to be in INFD_TCP_SERVER_CLOSED
or INFD_TCP_SERVER_BOUND
status for this function to be called. If server
's status is
INFD_TCP_SERVER_CLOSED
, then infd_tcp_server_bind()
is called before
actually opening the server.
|
A InfdTcpServer. |
|
Location to store error information. |
Returns : |
TRUE on success, or FALSE if an error occured. |
void infd_tcp_server_close (InfdTcpServer *server
);
Closes a TCP server that is open or bound.
|
A InfdTcpServer. |
"local-port"
property"local-port" guint : Read / Write
Port to bind to.
Allowed values: <= 65535
Default value: 0
"status"
property"status" InfdTcpServerStatus : Read
Status of the TCP server.
Default value: INFD_TCP_SERVER_CLOSED
"error"
signalvoid user_function (InfdTcpServer *infdtcpserver,
gpointer arg1,
gpointer user_data) : Run Last
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"new-connection"
signalvoid user_function (InfdTcpServer *infdtcpserver,
InfTcpConnection *arg1,
gpointer user_data) : Run Last
|
the object which received the signal. |
|
user data set when the signal handler was connected. |