#ifndef NETWORK_H
#define NETWORK_H
#include <stdio.h>
#include <stdbool.h>
#include <netinet/in.h>
typedef struct NetWork
{
int sock;
int type;
struct sockaddr_in addr;
socklen_t len;
bool svr;
}NetWork;
NetWork* nw_open(int type,short port,const char* ip,bool svr);
NetWork* nw_accept(NetWork* svr_nw);
size_t nw_send(NetWork* nw,const char* buf,size_t len);
size_t nw_sends(NetWork* nw,const char* buf);
size_t nw_recv(NetWork* nw,char* buf,size_t len);
void nw_close(NetWork* nw);
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#