嵌入式操作系统课程设计报告(编辑修改稿)内容摘要:
trcmp(recievemsgname,trans)==0) { return 1。 } if((fd=open(,O_RDWR|O_CREAT|O_APPEND,0666))0) { perror(open)。 printf(open\n)。 return 2。 } do { if((read_size=read(fd,amp。 cmpmsg,sizeof(cmpmsg))) 0) { perror(read)。 close(fd)。 return 2。 } if(read_size != sizeof(struct message) amp。 amp。 read_size !=0) { 嵌入式 操作系统课程 设计 19 close(fd)。 return 2。 } if(strcmp(recievemsgname,)==0) { close(fd)。 return 1。 } }while(read_size == sizeof(struct message))。 if((write_size=write(fd,recievemsg,sizeof(struct message)))0) { perror(write)。 close(fd)。 return 2。 } while(write_size!=sizeof(struct message)) { //write_size = 0writesize。 lseek(fd,write_size,SEEK_CUR)。 write_size=write(fd,recievemsg,sizeof(struct message))。 } printf(write file success\n)。 close(fd)。 return 0。 } int login_check(struct message *recievemsg) { int fd。 struct message cmpmsg。 int read_size。 if((fd=open(,O_RDONLY))0) { perror(open)。 return 2。 } do { if((read_size=read(fd,amp。 cmpmsg,sizeof(struct message)))0) { perror(read)。 close(fd)。 return 2。 } if(read_size != sizeof(struct message) amp。 amp。 read_size!=0) { close(fd)。 return 2。 } if((strcmp(recievemsgname,)==0)amp。 amp。 (strcmp(recievemsgmsg,)==0)) { close(fd)。 return 0。 } }while(read_size0)。 close(fd)。 return 1。 } /* void main() { struct message sendmsg。 printf(input name:\n)。 gets()。 printf(input mima:\n)。 gets()。 printf(%d\n,reg_check(amp。 sendmsg))。 // printf(%d\n,login_check(amp。 sendmsg))。 } 嵌入式 操作系统课程 设计 20 */ /************/ include include include include sys/ include i/ include include sys/ include sys/ include include include include sys/ include include sys/ define MAXLEN 1024 struct message { char flag[15]。 char name[10]。 int size。 char msg[MAXLEN]。 }。 struct msq { long msg_type。 char msg_text[5]。 }。 int qid = 1,fd = 1,sockfd,savefilefd=1。 char filefromname[10]。 void handleQuit(int signal_no) { if(fd 0) close(fd)。 close(sockfd)。 if(qid 0) { if((msgctl(qid,IPC_RMID,NULL))0) { printf(消息队列无法关闭 \n)。 exit(1)。 } } close(savefilefd)。 printf(程序正常退出 \n)。 raise(SIGQUIT)。 } void cutStr(char str[],char left[],int n,char right[],int m,char c) { int i,k,j。 for(i = 0。 i n。 i++) { if(str[i] == c) break。 } if(i == n) { i = 1。 } else { memset(left,0,strlen(left))。 for(k = 0。 k i。 k++) { left[k] = str[k]。 } } for(j = i+1。 j m。 j++) { if(str[j] == 39。 \039。 ) break。 right[ji1] = str[j]。 } left[i] = 39。 \039。 if(j m) right[ji1] = 39。 \039。 else right[m] = 39。 \039。 } void handlesendfile(void) { struct message filedata。 嵌入式 操作系统课程 设计 21 //printf(filefromname = %s \n,filefromname)。 do { memset(,0,sizeof())。 = read(savefilefd,1000)。 strcpy(,transf)。 strcpy(,filefromname)。 if ( == 0) { printf(文件传输完毕 \n)。 strcpy(,end$)。 } else if ( 0) { printf( = %s\n,)。 send(sockfd,amp。 filedata,sizeof(struct message),0)。 } else { printf(读取文件失败 ,文件传输中止\n)。 break。 } } while ( 0)。 close(savefilefd)。 savefilefd = 1。 } void handlerecvmsg(int *sockfd) { int connfd = *sockfd。 int nread。 char buf[1024]。 char str[1024]。 struct message recvmsg。 time_t timep。 struct msq msg。 if(( fd = open(,O_RDWR|O_CREAT|O_APPEND)) 0) { printf(打开聊天记录文件失败 !)。 exit(1)。 } // printf(%d\n,fd)。 if((qid = msgget(2222,IPC_CREAT|0666)) == 1) { printf(创建消息队列失败 \n)。 exit(1)。 } = getpid()。 strcpy(,OK)。 while(1) { nread = recv(connfd,amp。 recvmsg,sizeof(struct message),0)。 if(nread == 0) { printf(与服务器断开了连接 \n)。 close(fd)。 close(connfd)。 exit(0)。 } else if (strcmp(,all) == 0) { time (amp。 timep)。 sprintf(str,%s%s 发 给 所 有人 :%s\n\n,ctime(amp。 timep),g)。 } else if (strcmp(,sermsg) == 0) { time (amp。 timep)。 printf(%s 服 务 器 发 给 所 有人 :%s\n\n,ctime(amp。 timep),)。 continue。 } else if (strcmp(,view) == 0) { time (amp。 timep)。 printf(%s 当 前 在 线 客 户 嵌入式 操作系统课程 设计 22 端 :\n%s\n\n,ctime(amp。 timep),)。 continue。 } else if (strcmp(,trans) == 0) { pthread_t pid。 if (strcmp(,agree) == 0) { strcpy(filefromname,)。 //创建线程发送文件 pthread_create(amp。 pid,NULL,(void *)handlesendfile,NULL)。 } else if(strcmp(,disagree) == 0) { printf(对方拒绝接收文件 \n)。 close(savefilefd)。 savefilefd = 1。 } else if(strcmp(,noexist) == 0) { printf(该客户端不存在 \n)。 close(savefilefd)。 savefilefd = 1。 } else { strcpy(filefromname,)。 printf(%s 向你请求传名为 %s 文件 , 是 否 同 意 接 受 ?[agree( 同意 )|disagree( 不同意 )]\n,)。 savefilefd = 0。 } continue。 } else if(strcmp(,transf) == 0) { int n。 if(strcmp(,end$) == 0) { printf(文件传输结束 \n)。 close(savefilefd)。 savefilefd = 1。 continue。 } else { n=write(savefilefd,)。 // printf( = %s\n,)。 while(n amp。 amp。 n 0) { lseek(savefilefd,n,SEEK_CUR)。 n=write(savefilefd,)。 } } continue。 } else { time (amp。 timep)。嵌入式操作系统课程设计报告(编辑修改稿)
相关推荐
cvByte。 VICIntEnable = 10x06。 } void __irq UART0_RcvByte(void) { unsigned char IIR。 IIR = U0IIR。 if((IIRamp。 0x01)==0) { IIR = IIR amp。 0x0e。 if((IIR==0x04)||(IIR==0x0c)) { while(U0LSR amp。 0x01) {
81 42 现状 热负荷 本工程热负荷主要由 ***37家企业的烘烤、制胶、净化、 蒸 洗等生产用汽 组成。 园区现状热负荷见下 表 : 表 园区 现状热负荷表 序号 用汽 企业 单位 用汽量 (t/h) (a) (a) 1 银太纺织 t/h 4 2 晟泰纺织 t/h 3 3 万昌纺织 t/h 4 4 德胜纺织 t/h 3 5 东信棉业 t/h 4 6 华丰 塑业 t/h 1 7 华南塑业
Jj Llj ,1。 ,1 (3) 假设 N为 装配工作站的 总人数 , C是需要分配装配的时间,混合产品装配线平衡目标功能 和约束的问题在 方程 (9)叙述。 装配工作站 目标 功能的 第一 步是将 空闲时间 降到 最小。 这 意 味着 装配工作站 的 平均工作负荷 时间 (单位时间) 尽可能接近工作时间。 装配工作站的第二步是 尽量减少 平均装配工作量的 绝对偏 差,第二步是
, but they do not spend much money there. In a market in the Middle East, for example, people meet their friends and talk together. They look at the things in the market very carefully, and they
免发生意外 ,同时也要进行好日常的维护和 和管理 ,包括网站内容的更新,维护网站的安全。 当网站建立好之后,接着就是添加产品,注意产品的图片一定要凸显出产品的特点, 内容及时更新, 介绍也要更丰富一些,现在的客 户更喜欢内容详实的介绍,因为这样他们可以更了解这款产品从而增加购买这款产品的欲望。 还有很多方面需要我们注意 ,网站的设计和内容的设计上还是主要以增强用户体验和购买欲望为主。 三、
俊英 李 俊 鲍玉清 董树林 徐果女 锅炉水质化验员 HEWSSNZHFWDGW015 乔瑞霞 张晓慧 王晓苏 云素华 李苗苗 姬国芳 闻晶晶 薛彩霞 黄雪瑞 水泵运行工 HEWSSNZHFWDGW016 苏政远 屈利军 赵建国 闫志敏 刘志杰 杨 蒙 李建国 张 昊 丁岳胜 郭 俊 牛宝瑞 张 伟 刘成荣 孙 磊 达布希拉图 李智磊 张勇 呼日乐 高东升 陈庚 叶少飞 李彪 黄巴图 张如祥