网络通信程序设计及在气敏传感器测试系统中的应用

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

:2005-10:(1980),,,;(1963),,,,(,200072):TCP/IP,Windows:TCP/IP;Socket;/;;:TP393:B:1006-2394(2006)01-0050-02NetworkCommunicationProgramDesignBasedonTCP/IPandItsApplicationinGas2sensitivitySensorATSLIGuo,XUYong2jin,WANGZheng2hong(DepartmentofAutomation,ShanghaiUniversity,Shanghai200072,China)Abstract:SomeprimaryconceptonnetworkcommunicationprogramdesignbasedonTCP/IPwasintroduced.ThecommunicationprogramdesignbetweenmicroprocessorandcomputerbasedonWindowsoperatingsystemanditsapplicationingas2sensitivitysensorATSwereanalysed.Keywords:TCP/IP;Socket;client/servermodel;networkcommunication;ATS11.1TCP/IP,,(I/O),SocketSocket(API)SocketAPI,Socket111.2SocketWinsock(Socket),TCP/IP,,:(StreamSocket)(DatagramSocket),TCP,UDPWindows,SocketWinsockAPIWinsockAPI,Winsock[1]1.3/TCP/IP//,,,,[2]2,(),(),,,/,,,TCP0520061Windows,Rabbit3000,,TCP/IP,VC++6.0,CAsyncSocket;Socket,Rabbit3000:(1)tcpSocket;(2)sockinit(),;(3),tcplisten();(4)sockestablished();(5)sockread()sockwrite();(6)sockclose(),tcpSocket,,tcpSocket,tcptick(),10/s,:(a);(b)TCPsocket[3],()VC++6.0CAsyncSocketCreate()Connect()Send()Receive()Close()Rabbit3000,TCP,223():tcpSocketsock;//tcpSocket;intbytes1;//;intbytes2;//;charbuff1[800];//;charbuff2[800];//;sockinit();////voidestablishlink(void){if(!tcplisten(&sock,MYPORT,INCOMINGIP,INCOMINGPORT,NULL,0))printf(Failedtolisten\n);//tcplisten(),//Failedtolistenelsewhile(!sockestablished(&sock)){if(!tcptick(&sock)){printf(Failedtoestablish\n);break;}}//sockestablished(),}//Failedtoestablish//{tcptick(&sock)bytes1=sockfastread(&sock,buff1,BUFFSIZE);//;;}//{;bytes2=sockwrite(&sock,buff2,datalength);//;}():CXyjSocketCAsyncSocket,CXyjSockettcpsocket;//CXyjSocket;voidCMaincontrolerView::ConnectServer(){if(tcpsocket.Create(0,SOCKSTREAM,FDREAD|FDCONNECT|FDWRITE|FDCLOSE)==TRUE){intConnectOK=tcpsocket.Connect((SOCKADDR3)&mAddr,sizeof(mAddr));}//Create()Connect()}//,ConnectOK1,,:[1],,.VisualC++[M].:,2001.[2]W.RichardStevens,,,,.TCP/IP,:[M].:,2000.[3]RabbitSemiconductorCorporation.DynamicCTCP/IPUsersManual[Z].2002.()1520061

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功