Go to the source code of this file.
Data Structures | |
struct | ksock_s |
Defines | |
#define | MAXPENDING 5 |
Typedefs | |
typedef struct ksock_s | ksock_t |
Functions | |
int | ksock_server_open (ksock_t *server, unsigned short port) |
int | ksock_next_connection (ksock_t *server) |
int | ksock_exec_command (char *cmd) |
int | ksock_exec_command_pending (int clntSock, char *cmd) |
int | ksock_send_command (int socket, char *cmd,...) |
int | ksock_connect (char *servIP, unsigned short servPort) |
#define MAXPENDING 5 |
int ksock_connect | ( | char * | servIP, | |
unsigned short | servPort | |||
) |
Try to connect to the given server
clntSocket | The connection id | |
cmdBuffer | The receive buffer allocated by the caller | |
bufSize | The size of the receive buffer |
Definition at line 370 of file kb_socket.c.
References DieWithError(), and sock.
Referenced by main().
int ksock_exec_command | ( | char * | cmd | ) |
Execute a network command
cmd | the command line |
Definition at line 285 of file kb_socket.c.
References KB_ERROR, KB_ERROR_NOINIT, and kb_parse_command().
Referenced by main().
int ksock_exec_command_pending | ( | int | clntSock, | |
char * | cmd | |||
) |
Send a network command through the given socket and wait for an acknowledge from the server. If the acknowledge is not received before the given timeout, the function returns with an error code.
socket | the receiving socket | |
cmd | the command line |
The application should send the corresponding answer using ksock_send_answer.
Such network commands must use the following syntax: The fisrt word is the command name. The second word is the request id (unsigned long integer). The following words are the command parameters.
cmd | the command line | |
clntSock | the connection id |
Definition at line 260 of file kb_socket.c.
References KB_ALLOC, KB_ERROR, KB_ERROR_NOINIT, and kb_parse_command().
Referenced by main().
int ksock_next_connection | ( | ksock_t * | server | ) |
Get the next connection to the given server
Definition at line 82 of file kb_socket.c.
References DieWithError(), KB_WARN_CONNECT, kb_warning(), and ksock_s::serv_socket.
Referenced by main().
int ksock_send_command | ( | int | socket, | |
char * | cmd, | |||
... | ||||
) |
Send a network command through the given socket
socket | the receiving socket | |
cmd | the command line |
Definition at line 186 of file kb_socket.c.
References DieWithError(), ksock_buf_len, ksock_buf_snd, and ksock_command_terminator.
Referenced by handle_joyaxis(), and handle_joybutton().
int ksock_server_open | ( | ksock_t * | server, | |
unsigned short | port | |||
) |
Open a server socket
Definition at line 54 of file kb_socket.c.
References DieWithError(), MAXPENDING, ksock_s::serv_addr, and ksock_s::serv_socket.
Referenced by main().