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

📄 sockcomp.h

📁 socket compent我自己封装的socket组件
💻 H
字号:
/**********************************************************************************************
* Copyright (c) 1994,合肥合能电气有限责任公司
* All rights reserved.
*
* 文件名称: sockcomp.h
* 文件标识: 
* 摘要:     socket 组件
*
* 当前版本: 1.0
* 作者:     Highmayor
* 完成日期: 2005年6月2日
*
* 取代版本: 1.0
* 原作者:   Highmayor
* 完成日期: 2005年6月2日
***********************************************************************************************/
#ifndef _SOCKCOMP_H_
#define _SOCKCOMP_H_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <error.h>
#include <fcntl.h>
#include <memory.h>

#include "evardef.h"
#include "mytype.h"

#if defined (WIN32)
#include <winsock2.h>
#elif defined (LINUX)
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>//defined the function of "inet_addr()"
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include "sockdef.h"
#endif


#define MYMAKEWORD(x,y)  ((y)*256+(x))

MYBOOL initsockver(UCHAR minorversion, UCHAR majorversion);
int mysocket(int af, int type, int protocol);
MYBOOL mybind(int s, struct sockaddr_in name, int namelen);
MYBOOL SetReuseAddr(int s, MYBOOL reuseaddr);
MYBOOL myconnect(int s,  struct sockaddr_in name, int namelen);
MYBOOL mynbconnect(int s, struct sockaddr_in name, int namelen, long second, long usecond);
MYBOOL getsocketstatus(int s);

void getlocalhostinfo(UCHAR * lhn, UCHAR * lha);
void getremotehostinfo(int s, struct sockaddr_in remote_host_addr);
BOOL setsocketmode(int s, ULONG ul);

int myrecv(int s, UCHAR * buf, int len, int flags);
int myselectrecv(int s, UCHAR * buf, int len, int flags);
MYBOOL setrecvtimeout(int s, int timeout);
MYBOOL mysend(int s, const UCHAR * str);
void myselectsend(int s, const UCHAR * str);
MYBOOL setsendtimeout(int s, int timeout);
MYBOOL masknagle(int s, MYBOOL nodelay);
MYBOOL myclosesocket(int s);
MYBOOL myWSACleanup();


void printsocketerror(UINT errorcode);



#endif

⌨️ 快捷键说明

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