projects
/
my-code
/
api.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some changes to network api
[my-code/api.git]
/
network
/
network.c
diff --git
a/network/network.c
b/network/network.c
index
1160e7c
..
aefb7c2
100644
(file)
--- a/
network/network.c
+++ b/
network/network.c
@@
-7,17
+7,22
@@
#include "network.h"
int network_init(t_net *net,int outfd) {
#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;
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;
if((net->l_fd=socket(AF_INET,SOCK_STREAM,0))==-1) {
perror("[network] socket call");
return N_ERROR;