东莞建设银行官方网站,专业网站设计服务商,腾讯服务商平台,沈阳网站建设的价格本程序是在Linux下开发的,使用的是C语言,再结合Socket进行编程,分为客户端和服务器两个程序,即采用的是C/S架构,相应的源代码如下: 服务器端:
#include stdio.h
//#include stdlib.h
#include sys/socket.h
#include netinet/in.h本程序是在Linux下开发的,使用的是C语言,再结合Socket进行编程,分为客户端和服务器两个程序,即采用的是C/S架构,相应的源代码如下: 服务器端:
#include stdio.h
//#include stdlib.h
#include sys/socket.h
#include netinet/in.h
#include netdb.h
#include sys/types.h
#include sys/stat.h
#include fcntl.h
#include unistd.h#define LISTENQ 5
#define DUMMY 0
#define BUFSIZE 1024
#define PORT 6666int main()
{
int listenfd, connfd;
int source_fd, num;
char iobuffer[BUFSIZE];socklen_tlen;
struct sockaddr_inservaddr, cliaddr;
char *filename="200911122224040961.jpg";//服务器发送的文件是当前目录下的文件listenfd=socket(AF_INET, SOCK_STREAM,0);if(