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

📄 tcplib.h

📁 DOS下的TCP/IP源代码,可以做参考.
💻 H
字号:
typedef char* TCPSocket;
typedef char* UDPSocket;
typedef union {unsigned char ip[4];unsigned long ina;} IP;
//========================================================
void init_tcplib(void);
void release_tcplib(void);
void settcpdebug(int d);
void gethostip(char *ip);
void sethostip(char *ip);
void setcurrentpath(char *path);
void dospath(char *s,char *s1);
void dosname(char *s,char *s1);
long int lenfile(char *filename);
//=================================================
UDPSocket new_udpsocket(void);
void release_udpsocket(UDPSocket hl);
int  udp_kernal(UDPSocket hl);
int  open_udp(UDPSocket Sock,char *host,int port);
int  udp_recv_time(UDPSocket Sock,char *buf,int mlen,int tout);
int  udp_recv(UDPSocket Sock,char *buf,int mlen);
int  udp_send_back(UDPSocket Sock,int port,char *buf,int len);
int  listen_udp(UDPSocket Sock,int port);
int  peer_udp_data(UDPSocket hl);
int  close_udp(UDPSocket Sock);
int  udp_send(UDPSocket Sock,char *buf,int len);
//======================================================
TCPSocket new_socket(void);
void release_socket(TCPSocket hl);
int  tcp_kernal(TCPSocket hl);
int  open_tcp(TCPSocket hl,int lport, unsigned long ina, int port);
int  open_success_tcp(TCPSocket hl);
int  set_tcp_mode(TCPSocket hl,int mode);
int  connect_tcp(TCPSocket sock,char *host, int port);
int  disconnect_tcp(TCPSocket sock);
int  write_tcp(TCPSocket hl,char *str,int len,int noptime);
int  read_tcp(TCPSocket hl,char *buf,int len);
int  read_tcp_time(TCPSocket hl,char *buf,int len,int tout);
int  tcp_getline(TCPSocket sock, char *buffer, int len);
void empty_tcp(TCPSocket hl);
void close_tcp_socket(TCPSocket hl);
int  listen_tcp(TCPSocket hl,int lport);
void get_tcp_peer(TCPSocket hl,char *ip);
int  peer_tcp_data(TCPSocket hl);
int  get_ip_port(char *buf,unsigned short *ip);
//===================================================
TCPSocket gethttpsocket(void);
void filetype(char* arg,char *type);
int  http_file(TCPSocket hl,char *filename,int noptime);
int  http_head(TCPSocket hl,char *type,long int len,int noptime);
void htmlerror(TCPSocket hl,int noptime);
int  htmllist(TCPSocket hl,int noptime,char *path,char *url);
int  gethttpport(void);
void sethttpport(int port);
void sethttppath(char *path);
void sethttptime(int nop,int srv);
void starthttp(int n);
void releasehttp(void);
int  checkhttp(void);
int  httprequest(void);
char *gethttpuserinput(void);
//=============================================
void startftp(void);
void releaseftp(void);
int  checkftp(void);
void Serveftp(void);
void setftptime(int nop,int srv);
int  setftpuserpass(char *u,char *p,int r);
//=========================================
int httpget(char *host,int port,char *path, char *lfile,int tout);
int ftpdownload(char *server,int port,char *user,char *pass,char *rfile,char *lfile,int tout);
int ftpupload(char *server,int port,char *user,char *pass,char *rfile,char *lfile,int tout);
int smtpsend(char *host,int port,char *from,char *to,char *cc,char *bcc,char *title,char *body);

//======================================================
void starthttpftp(int n);
void releasehttpftp(void);
int  checkhttpftp(void);
void sethttpftpport(int port);
char *getechoinput(void);
//========================================================

⌨️ 快捷键说明

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