ÄãºÃ£¬»¶Ó­À´µ½¾­¹ÜÖ®¼Ò [µÇ¼] [×¢²á]

ÉèΪÊ×Ò³ | ¾­¹ÜÖ®¼ÒÊ×Ò³ | Êղر¾Õ¾

ÍøÂ缴ʱͨѶϵͳµÄ¿ª·¢ÓëʵÏÖ_¼ÆËã»úרҵÂÛÎÄ·¶ÎÄ

·¢²¼Ê±¼ä£º2015-01-16 À´Ô´£ºÈË´ó¾­¼ÃÂÛ̳
¼ÆËã»úרҵÂÛÎÄ·¶ÎÄ Õª Òª »¥ÁªÍø´Óµ®ÉúÒÔÀ´£¬¾Í¿ªÊ¼Ó°Ïì×ŵØÇòµÄÿһ¸ö½ÇÂ䣬¸øÓèÁËÈËÀàÒ»ÖÖȫеÄÉú»î·½Ê½£¬Ëæ×Å»¥ÁªÍø¼¼ÊõµÄ²»¶Ï·¢Õ¹£¬ÐÂÐ˵ļ¼ÊõÒ²²ã³ö²»Ç¼´Ê±Í¨ÐÅϵͳ¾ÍÊÇÕâôһÖÖÒÔÁÄÌìÐÎʽΪÖ÷µÄ¹ãÊÜ»¶Ó­µÄ»¥ÁªÍø¼¼Êõ¡£ÏÖÔÚ¼´Ê±Í¨Ñ¶ÏµÍ³·þÎñµÄÄÚ²¿ÍØÆËÖд󲿷ֲÉÓÿͻ§/·þÎñÆ÷Ä£ÐÍ£¬¿Í»§/·þÎñÆ÷/¿Í»§Ä£ÐͺͿͻ§/¿Í»§Ä£ÐÍ£¬²¢ÇÒÊг¡ÉÏÓ¦Óõĺܶ༴ʱͨÐÅÈí¼þ±ÈÈçQQºÍMSN¶¼²ÉÓõÄÊÇ¿Í»§/·þÎñÆ÷/¿Í»§Ä£ÐÍ£¬ÓÉÓÚËüÃǶ¼ÐèÒªÓÉλÓÚÖÐÐĵķþÎñÆ÷À´Ð­µ÷£¬Õâ¶ÔһЩÏëÓµÓÐ×Ô¼ºÄÚ²¿¼´Ê±Í¨ÐÅÈí¼þµÄСÆóÒµºÍ¼ÒÍ¥µÄ¾ÖÓòÍøÓû§À´Ëµ£¬·þÎñÆ÷µÄ³É±¾ÊµÔÚÊÇÌ«´ó£¬ÓÚÊÇÎÒ±ãÓÐÁ˱àд±¾Èí¼þµÄ¹¹Ïë¡£±¾Èí¼þ¹¦Äܳɹ¦°ÚÍÑÁËÖÐÐÄ·þÎñÆ÷µÄÊø¸¿£¬ËüµÄ»ù±¾¹¦ÄܾÍÊÇÈÃÓû§Äܹ»ÔÚ¾ÖÓòÍøÉÏͨ¹ý²ÉÓÃTCP/IPЭÒé½øÐеã¶Ôµã½»Á÷¡£±¾Èí¼þͨ¹ýVisual C++Èí¼þ´´½¨µÄÊǶԻ°¿òÓ¦ÓóÌÐò£¬Á¬½Óºó·þÎñÆ÷¿ÉÒԳ䵱¿Í»§»ú£¬¿Í»§»úÒ²¿ÉÒԳ䵱·þÎñÆ÷¡£ËüÃÇ¿ÉÒÔͬһ̨¼ÆËã»úÉÏ£¬Ò²¿ÉÒÔ°ÑÓ¦ÓóÌÐò¸´ÖƵ½Áíһ̨¼ÆËã»úÉÏ£¬ÕâÑùûÓÐÖмä·þÎñÆ÷´æÔÚ£¬ÔÚÁ½¸ö¶ÀÁ¢µÄ¼ÆËã»úÉÏ·Ö±ðÔËÐÐÓ¦ÓóÌÐò£¬´Ó¶øͨ¹ýÍøÂç´«µÝÏûÏ¢¡£ ¹Ø¼ü´Ê£ºP2P¡¢TCP/IP¡¢Visual C++¡¢Í¨ÐÅ Abstract Internet since its birth, begin to affect every corner of our planet, giving a whole new way of life mankind, with the continuous development of Internet technology, emerging technologies are emerging, real-time communication system is such a kind of chat formpopular Internet-based technology.Now an internal instant messaging system service topology is mostly client/server model, client/server/ client model and the customer/client model, and the market in many instant messagi- -ng software applications such as QQ and MSN are using the client/server /client model, because they need from the server is located in the center to coordinate, which some want to have their own internal instant messaging software for small businesses and home LAN users, the server cost is too great, so I have a prepared the software concept.The software features a central server successfully get rid of the shackles of its basic function is to enable users to the LAN through the use of TCP/IP protocol for point to point communication.This software by Visual C ++ software application to create the dialog box, connected to the server can act as a client, the client can also act as a server.They can be the same computer, the application could also be copied to another computer, so there is no intermediate servers, in two separate computer running the application, respectively, to pass messages through the network. Keywords£ºP2P¡¢TCP/IP¡¢ Visual C++¡¢Communicate Ä¿ ¼ ÕªÒª¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.¢ò 1 Ð÷ÂÛ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.1 1.1 ¿ÎÌâµÄ±³¾°¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­1 1.2 ¼´Ê±Í¨ÐÅϵͳӦÓÃÏÖ×´¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.2 1.3 Èí¼þ¿ª·¢Éè¼Æ˼ÏëºÍϵͳ¹¦ÄÜ ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­5 1.3.1 ¿ª·¢Éè¼Æ˼Ïë¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.5 1.3.2 ϵͳ¹¦ÄÜ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­5 1.3.3 ϵͳ¹¦ÄÜÄ£¿éÉè¼Æ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­5 2 ¼´Ê±Í¨ÐÅϵͳµÄ¼¼Êõ±³¾°¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.6 2.1 ¼´Ê±Í¨ÐÅϵͳ½á¹¹Ä£ÐÍ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.6 2.1.1 ¼´Ê±Í¨ÐÅϵͳ½á¹¹Ä£Ð͵ÄÑ¡Ôñ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.6 2.1.2 P2P¼¼ÊõµÄÌص㡭¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.6 2.1.3 P2PÍøÂçģʽ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.7 2.1.4 P2PÍøÂçÖеĵØÖ·¶¨Î»¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.8 2.1.5 P2P¼¼ÊõÃæÁÙµÄÎÊÌâ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­9 2.2 ¼´Ê±Í¨ÐÅϵͳͨÐÅЭÒéÑ¡Ôñ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­10 2.2.1 TCP/IPЭÒé¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­10 2.2.2 TCPЭÒé¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­12 2.2.3 UDPЭÒé¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.12 2.2.4 ×ܽᡭ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.12 3 Visual C++µÄÍøÂç±à³Ì¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­13 3.1 Windows Socket ¼ò½é¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­13 3.2 Socket( Ì×½Ó×Ö£©¼ò½é¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­13 3.3 »ùÓÚTCP£¨ÃæÏòÁ¬½Ó£©µÄSocket±à³Ì¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.14 3.4 MFC¶ÔSocketµÄÖ§³Ö¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­16 3.4.1 MFC¼ò½é¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­16 3.4.2 ×ܽᡭ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­19 4 ¼´Ê±Í¨Ñ¶ÏµÍ³µÄÉè¼ÆºÍʵÏÖ20 4.1 ¼´Ê±Í¨Ñ¶ÏµÍ³Ö÷ҪʵÏֵŦÄܺͲ»×ã¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­.20 4.1.1 Ìí¼ÓºÃÓѹ¦ÄÜ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­20 4.1.2 ÁÄÌ칦ÄÜ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­20 4.1.3 Çå³ý¼Ç¼ºÍ±£´æ¼Ç¼¹¦ÄÜ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­20 4.1.4 ´°¿ÚÌØЧ¹¦ÄÜ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­21 4.1.5 ×ܽᡭ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­21 4.2 ¼´Ê±Í¨ÐÅϵͳ¾ßÌåʵÏÖ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­21 4.2.1 Ö÷½çÃæÉè¼Æ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­21 4.2.2 Ìí¼ÓºÃÓѽçÃæÉè¼Æ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­25 4.2.3 ÁÄÌì½çÃæÉè¼Æ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­30 4.2.4 ÌØЧ¹¦ÄÜʵÏÖÉè¼Æ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­38 4.3 ϵͳµÄ±àÒë¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­44 4.4 ×ܽᡭ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­45 5 ×ܽᡭ¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­46 ÖÂл¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­47 ²Î¿¼ÎÄÏס­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­48
¾­¹ÜÖ®¼Ò¡°Ñ§µÀ»á¡±Ð¡³ÌÐò
  • ɨÂë¼ÓÈë¡°¿¼ÑÐѧϰ±Ê¼ÇȺ¡±
ÍƼöÔĶÁ
¾­¼ÃѧÏà¹ØÎÄÕÂ
±êÇ©ÔÆ
¾­¹ÜÖ®¼Ò¾«²ÊÎÄÕÂÍƼö