当前位置: 技术问答>linux和unix
谁能给点编写qq类的通讯软件的资料呀!![300等待]
来源: 互联网 发布时间:2015-05-07
本文导语: 我要在15天内编写一个通讯类的软件,可以说是qq的简易版本。那位高手可以提供点资料呀!!300等待。 | /* * bsocket.h - declarations/definitions for BSD socket operation * * Gang He - dchg2000@mail...
我要在15天内编写一个通讯类的软件,可以说是qq的简易版本。那位高手可以提供点资料呀!!300等待。
|
/*
* bsocket.h - declarations/definitions for BSD socket operation
*
* Gang He - dchg2000@mail.com .
*/
#ifndef _HEGANG_BSOCKET_H_
#define _HEGANG_BSOCKET_H_
#include
#include
/*
* Redefine custom data type
*/
typedef int SOCKET;
typedef unsigned short PORT;
/*
* Define compatible macro
*/
#define INVALID_SOCKET 0
#define SOCKET_RECV_TIMEOUT -2
/*
* Create socket
*/
SOCKET create_bsocket(int domain, int type, int protocol);
/*
* Listen socket
*/
int listen_bsocket(SOCKET sock, PORT port);
/*
* Accept socket
*/
SOCKET accept_bsocket(SOCKET sock, char* ip_addr);
/*
* Connect socket
*/
int connect_bsocket(SOCKET sock, char* ip, PORT port);
/*
* Receive data from socket
*/
int recv_bsocket(SOCKET sock, void* pbuf, size_t bufsize, int timeout);
/*
* Send data to socket
*/
int send_bsocket(SOCKET sock, const void* pbuf, size_t bufsize);
/*
* Close socket
*/
void close_bsocket(SOCKET *sock);
#endif
* bsocket.h - declarations/definitions for BSD socket operation
*
* Gang He - dchg2000@mail.com .
*/
#ifndef _HEGANG_BSOCKET_H_
#define _HEGANG_BSOCKET_H_
#include
#include
/*
* Redefine custom data type
*/
typedef int SOCKET;
typedef unsigned short PORT;
/*
* Define compatible macro
*/
#define INVALID_SOCKET 0
#define SOCKET_RECV_TIMEOUT -2
/*
* Create socket
*/
SOCKET create_bsocket(int domain, int type, int protocol);
/*
* Listen socket
*/
int listen_bsocket(SOCKET sock, PORT port);
/*
* Accept socket
*/
SOCKET accept_bsocket(SOCKET sock, char* ip_addr);
/*
* Connect socket
*/
int connect_bsocket(SOCKET sock, char* ip, PORT port);
/*
* Receive data from socket
*/
int recv_bsocket(SOCKET sock, void* pbuf, size_t bufsize, int timeout);
/*
* Send data to socket
*/
int send_bsocket(SOCKET sock, const void* pbuf, size_t bufsize);
/*
* Close socket
*/
void close_bsocket(SOCKET *sock);
#endif