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

📄 commfun.cpp

📁 使用于2410终端上的一个播放类似ppt文件的程序,涉及Tcp/IP通信、局域网广播、Qt视窗系统、pThread等多个方面。修改makefile中编译工具即可编译
💻 CPP
字号:
#include <netinet/in.h>#include <arpa/inet.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <syslog.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <termios.h>#include <sys/socket.h>#include <pthread.h>#include "mytypes.h"int savefile(char* filename,char* pdata,int ilen){	FILE* file=fopen(filename,"w+b");	fwrite(pdata,1,ilen,file);	fclose(file);}int recvn(int sock,char* pbuff,int ilen){	//assert(sock>0&&pbuff&&ilen>0);	int irevlen=0,i;	char * ptemp=pbuff;	while(irevlen<ilen)	{		if ((i=recv(sock,ptemp,1024,0))>0)		{			irevlen+=i;			ptemp+=i;		}			else return -1;	}	return 1;}

⌨️ 快捷键说明

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