【正文】
保存在草稿箱當(dāng)中。recv_msg)函數(shù),把接收到的信息打印到終端上去,再調(diào)用函數(shù)recv_save_(amp。MSG *buf = NULL。 buf = (MSG *)malloc(sizeof(MSG))。recv_msg,0,sizeof(deliver))。recv_msg,sizeof(deliver))。recv_msg)。recv_msg,argv[4])。recv_msg,buf)。 //head = msg_insert(head,buf)。 buf = NULL。13111client send()函數(shù)把信息發(fā)給131二級(jí)服務(wù)器。send_msg,sizeof(submit),0)。msg one_scli。 printf(\n***zhuan fa to %s server ****\n,)。one_scli,sizeof(msg),0)。send_msg,sizeof(deliver),0)。memset(amp。 n = recv(,amp。 if(n = 0) { printf(sonser %s exit\n,)。 } for(i = 0。i++) { if(0 == strncmp(,[i].num,3)) { send([i].fd,amp。 } }130二級(jí)服務(wù)器接收到一級(jí)服務(wù)器的信息時(shí),就會(huì)通過號(hào)碼的匹配吧信息發(fā)給13011這個(gè)客戶端,實(shí)現(xiàn)了夸號(hào)碼段轉(zhuǎn)發(fā)。 int i。send_msg,sizeof(deliver),0)。i geshu。 strcpy(ss,)。 strcpy(,)。 send(all_cli[i].fd,amp。 printf(\n***send to %s client from %s client siccess****\n,ss,)。 } } 圖13收信息運(yùn)行圖如圖13所示是查看收信箱的信息,其中調(diào)用了recv_print_(argv[4])函數(shù)把儲(chǔ)存在文件中的短信信息多打印在終端上,可以顯示短信的發(fā)送者號(hào)碼和發(fā)送時(shí)間和具體的短信內(nèi)容。 int j。 FILE *fp = NULL。 char chose。 if(NULL == fp) { printf(open fail !)。 } while(1) { memset(amp。 fread(amp。 i++。 } for(j = 0。j++) { leng = j + 1。 printf(%d\n,leng) printf(num: %s\ntime: %smessage: %s\n,arr_msg[j].num,arr_msg[j].time,arr_msg[j].message)。} 測(cè)試的目的及意義測(cè)試的目的就是為了是尋找程序中的錯(cuò)誤,而且是盡可能的去找出程序中的盡可能多錯(cuò)誤[11]。如果程序員不能及時(shí)的將這些錯(cuò)誤找出來并修改,有可能會(huì)造成系統(tǒng)無法正常工作造成一些損失。所以要通過測(cè)試,盡量的減少程序中的錯(cuò)誤,從而達(dá)到系統(tǒng)穩(wěn)定運(yùn)作的目的,使短信收發(fā)系統(tǒng)工作不會(huì)收到影響。 二級(jí)服務(wù)器的性能測(cè)試圖15二級(jí)服務(wù)器測(cè)試圖如圖15所示是大量的client端連接到二級(jí)服務(wù)器上的,然后在測(cè)試二級(jí)服務(wù)器能否把信息的傳遞,在測(cè)試的過程中由于電腦性能的緣故,在信息發(fā)送的時(shí)候會(huì)出現(xiàn)一些的卡頓,但是信息還是可以正常的發(fā)送的。另一方面測(cè)試可以檢測(cè)出系統(tǒng)中的一些bug,有些bug只有通過大量的重復(fù)測(cè)試才可以顯示出來的,然后在解掉bug,優(yōu)化系統(tǒng)的功能,讓用戶能夠有更好的用戶體驗(yàn)。在這幾個(gè)月當(dāng)中多是利用晚上的時(shí)間去編寫程序的,在編寫程序的過程中也遇到很多的苦難,用對(duì)一些知識(shí)還不是很熟,用起來會(huì)出現(xiàn)一些錯(cuò)誤,但是最終通過網(wǎng)絡(luò),通過指導(dǎo)老師還是把這些問題給解決了。因?yàn)樽约褐R(shí)體系還不是特別的完整,編程能力也沒有特別的強(qiáng),所以系統(tǒng)并沒有那么的完善,所以在以后的工作中還是要繼續(xù)的學(xué)習(xí),提升自己的編程能力和分析問題的能力。轉(zhuǎn)眼間大學(xué)的四年就要結(jié)束了,能讓我的大學(xué)畫上完美的句號(hào)和畢業(yè)答辯能夠取得圓滿的成功。幫助我解決一些自己不能夠很好解決的問題,這樣我的畢業(yè)設(shè)計(jì)才能順利的完成。參考文獻(xiàn)[1][M].北京:機(jī)械工業(yè)出版社,2001.[2](3版)[M].武漢:華中科技大學(xué)出版社,2000.[3][M].北京:清華大學(xué)出版社,2000.[4]金鐘夫,[J].微計(jì)算機(jī)信息,2002,32,8789.[5]鄭燕飛,[J]., 21(1):8182[6]王群,[J].計(jì)算機(jī)與現(xiàn)代化,2003(10):78.[7]任泰明著. TCP/IP協(xié)議與網(wǎng)絡(luò)編程[M]. 西安:西安電子科技大學(xué)出版社. 2004.[8]謝希仁. 計(jì)算機(jī)網(wǎng)絡(luò)(5版)[M]. 西安:電子工業(yè)出版社. [9][D]..[10]趙穎,韓秀梅,[J].[11]陳波,石旭剛,[J].,(11):5556.英文摘要Design and implementation of SMS Linux transceiver system based on CStudent majoring in puter science and technology Qin ZhangYang Tutor Liu BinAbstract:The messaging system is Linux under the C language, based on multithreading, GMS protocol, select non blocking, using TCP connection and transmission mode and network programming. I want to do is to simulate the mobile phone short message form to send and receive SMS, a server to manage multiple service level to two, then the two stage management server to multiple clients, through the design of two layer load balancing server to realize the server, so the same number section number can be achieved the client message through the number of segments of two level servers to send and receive information, different numbers of transmit information through a mail client server, through the implementation of this system can be used to learn the knowledge link, consolidate and enhance the ability of their own programming.Keywords: C/S。 Send and receive text messages。 multi thread19