lunp
|
#include "lunp.h"
Funzioni | |
static void | tcpServerPreforked (SOCKET sockfd, int childCount, myTcpServerChildTask childTask) |
static void | tcpServerOCPC (SOCKET sockfd, myTcpServerChildTask childTask, bool resetSigInt) |
static void | tcpServerOCPCMax (SOCKET sockfd, int maxChildCount, myTcpServerChildTask childTask, bool resetSigInt) |
static void | waitForZombieChildren () |
static void | sigchldHandler (int s) |
static void | sigintHandler (int s) |
SOCKET | myTcpServerAccept (SOCKET sockfd, struct sockaddr_in *clientStruct) |
Accetta una connessione sul socket TCP specificato. Continua... | |
SOCKET | myTcpServerStartup (const char *serverPort) |
Crea un socket TCP associato alla porta specificata. Continua... | |
void | myTcpServerSimple (SOCKET sockfd, myTcpServerChildTask childTask) |
Implementa un server TCP che serve un client per volta. Continua... | |
void | myTcpServerOCPC (SOCKET sockfd, myTcpServerChildTask childTask) |
Implementa un server TCP che serve più client tramite il fork di più processi figlio, uno per client. Continua... | |
void | myTcpServerOCPCMax (SOCKET sockfd, int maxChildCount, myTcpServerChildTask childTask) |
Implementa un server TCP che serve fino a maxChildCount client tramite il fork di più processi figlio, uno per client. Continua... | |
void | myTcpServerPreforked (SOCKET sockfd, int childCount, myTcpServerChildTask childTask) |
Implementa un server TCP che serve fino a childCount client tramite il pre-fork di childCount processi figlio. Continua... | |
void | myTcpServerMixed (SOCKET sockfd, int minChildCount, myTcpServerChildTask childTask) |
Implementa un server TCP che serve più client tramite il pre-fork di minChildCount processi figlio. Continua... | |
void | myTcpServerMixedMax (SOCKET sockfd, int minChildCount, int maxChildCount, myTcpServerChildTask childTask) |
Implementa un server TCP che serve fino a maxChildCount client tramite il pre-fork di minChildCount processi figlio. Continua... | |
void | myTcpServerSelect (SOCKET sockfd, int maxChildCount, myTcpServerSelectChildTask childTask) |
Implementa un server TCP che serve fino a maxChildCount client nello stesso processo. Continua... | |
Variabili | |
static int | numChildren_ocpc = 0 |
static int | numChildren_preforked = 0 |
static pid_t * | childpids |
Accetta una connessione sul socket TCP specificato.
sockfd | Il file descriptor del socket TCP su cui accettare la connessione. |
clientStruct | La struttura contenente le informazioni sul client. |
void myTcpServerMixed | ( | SOCKET | sockfd, |
int | minChildCount, | ||
myTcpServerChildTask | childTask | ||
) |
Implementa un server TCP che serve più client tramite il pre-fork di minChildCount
processi figlio.
sockfd | Il file descriptor del socket a cui i client si connettono. |
minChildCount | Il numero minimo di processi figlio generati con il pre-fork. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
void myTcpServerMixedMax | ( | SOCKET | sockfd, |
int | minChildCount, | ||
int | maxChildCount, | ||
myTcpServerChildTask | childTask | ||
) |
Implementa un server TCP che serve fino a maxChildCount
client tramite il pre-fork di minChildCount
processi figlio.
sockfd | Il file descriptor del socket a cui i client si connettono. |
minChildCount | Il numero minimo di processi figlio generati con il pre-fork. |
maxChildCount | Il numero massimo di client da servire allo stesso tempo. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
void myTcpServerOCPC | ( | SOCKET | sockfd, |
myTcpServerChildTask | childTask | ||
) |
Implementa un server TCP che serve più client tramite il fork di più processi figlio, uno per client.
sockfd | Il file descriptor del socket a cui i client si connettono. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
void myTcpServerOCPCMax | ( | SOCKET | sockfd, |
int | maxChildCount, | ||
myTcpServerChildTask | childTask | ||
) |
Implementa un server TCP che serve fino a maxChildCount
client tramite il fork di più processi figlio, uno per client.
sockfd | Il file descriptor del socket a cui i client si connettono. |
maxChildCount | Il numero massimo di client da servire allo stesso tempo. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
void myTcpServerPreforked | ( | SOCKET | sockfd, |
int | childCount, | ||
myTcpServerChildTask | childTask | ||
) |
Implementa un server TCP che serve fino a childCount
client tramite il pre-fork di childCount
processi figlio.
sockfd | Il file descriptor del socket a cui i client si connettono. |
childCount | Il numero massimo di client da servire allo stesso tempo. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
void myTcpServerSelect | ( | SOCKET | sockfd, |
int | maxChildCount, | ||
myTcpServerSelectChildTask | childTask | ||
) |
Implementa un server TCP che serve fino a maxChildCount
client nello stesso processo.
sockfd | Il file descriptor del socket a cui i client si connettono. |
maxChildCount | Il numero massimo di client da servire allo stesso tempo. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
void myTcpServerSimple | ( | SOCKET | sockfd, |
myTcpServerChildTask | childTask | ||
) |
Implementa un server TCP che serve un client per volta.
sockfd | Il file descriptor del socket a cui i client si connettono. |
childTask | La funzione da chiamare ogni volta che un client si connette al socket sockfd . |
SOCKET myTcpServerStartup | ( | const char * | serverPort | ) |
Crea un socket TCP associato alla porta specificata.
serverPort | La porta del server a cui associare il socket creato. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |