]> hackdaworld.org Git - my-code/api.git/commitdiff
some changes to network api
authorhackbard <hackbard>
Thu, 28 Oct 2004 18:53:51 +0000 (18:53 +0000)
committerhackbard <hackbard>
Thu, 28 Oct 2004 18:53:51 +0000 (18:53 +0000)
network/network.c
network/network.h

index 1160e7c227802d8124b47e48daaeb7c325595ac0..aefb7c2e9b8e4d00f67ad9bbd0ee08d7eb6ef9d4 100644 (file)
@@ -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;
index d234d9cffa1b29be77ab9cdbd8966231a0b2ccf9..281a43feddf10460d72c4637d1b3b331d37cb1e7 100644 (file)
@@ -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);