seg-database-c/inc/netapi.h
2026-07-10 17:53:18 +08:00

55 lines
771 B
C

#ifndef _NETAPI_H_
#define _NETAPI_H_
#define IPMODE_IPV4 0
#define IPMODE_IPV6 1
int socket_connect(
const char *ip,
const int port,
const int timeout,
const int ipmode,
int *pSockfd);
int socket_send(
int fd,
char *buf,
int len);
int socket_recv(
int fd,
char *buf,
int len);
void socket_close(
int fd);
int socket_connect_noblock(
const char* ip,
const int port,
const int timeout,
const int ipmode,
int* pSockfd);
int socket_send_noblock(
int fd,
char *buf,
int len,
struct timeval start_time,
int deal_time);
int socket_recv_noblock(
int fd,
char *buf,
int len,
struct timeval start_time,
int deal_time);
void socket_close_noblock(
int fd);
int ms_difftime(
struct timeval start_time,
struct timeval end_time);
#endif