From: hackbard Date: Thu, 28 Oct 2004 18:53:51 +0000 (+0000) Subject: some changes to network api X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=f1e40c5f6f45802b479563b63e3e443355f96157;p=my-code%2Fapi.git some changes to network api --- diff --git a/network/network.c b/network/network.c index 1160e7c..aefb7c2 100644 --- a/network/network.c +++ b/network/network.c @@ -7,17 +7,22 @@ #include "network.h" int network_init(t_net *net,int outfd) { - - struct sockaddr_in addr; - int true; - - dprintf(outfd,"[network] initializing network ...\n"); + + dprintf(net->outfd,"[network] initializing network api ...\n"); memset(net->connection,0,MAX_CONNECTIONS*sizeof(t_connection)); net->c_count=0; net->sendmask=0; net->outfd=outfd; + return N_SUCCESS; +} + +int network_listen(t_net *net) { + + struct sockaddr_in addr; + int true; + if((net->l_fd=socket(AF_INET,SOCK_STREAM,0))==-1) { perror("[network] socket call"); return N_ERROR; diff --git a/network/network.h b/network/network.h index d234d9c..281a43f 100644 --- a/network/network.h +++ b/network/network.h @@ -68,6 +68,7 @@ typedef struct s_net { /* function prototypes */ int network_init(t_net *net,int outfd); +int network_listen(t_net *net); int network_shutdown(t_net *net); int network_set_listen_port(t_net *net,in_port_t port); int network_manage_connection(t_net *net);