⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 net.h

📁 非常好用的网络socket编程代码(服务器端多线程)
💻 H
字号:
/*
 *  This file is provided for use with the unix-socket-faq.  It is public
 *  domain, and may be copied freely.  There is no copyright on it.  The
 *  original work was by Vic Metcalfe (vic@brutus.tlug.org), and any
 *  modifications made to that work were made with the understanding that
 *  the finished work would be in the public domain.
 *
 *  If you have found a bug, please pass it on to me at the above address
 *  acknowledging that there will be no copyright on your work.
 *
 *  The most recent version of this file, and the unix-socket-faq can be
 *  found at http://www.interlog.com/~vic/sock-faq/.
 */

#ifndef _NET_H_
#define _NET_H_

#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <limits.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <fcntl.h>

/* On some crazy systems, these aren't defined. */
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif

int Create_sock(int socket_type, u_short port, int *listener);
int SetNBlock(int iSock);
int atoport(char *service, char *proto);
struct in_addr *atoaddr(char *address );
int get_connection(int socket_type, u_short port, int *listener );
int make_connection(int *psock,char * service, int type, char *netaddress);
int sock_read( int sockfd, char *buf, size_t count );
int sock_write(int sockfd, const char *buf, size_t count );
int sock_gets( int sockfd, char *str, size_t count);
int sock_puts( int sockfd, const char *str );
void ignore_pipe(void);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -