Detailed analysis of IP Messenger

Source: Internet
Author: User

IP MessengerDetailed analysis

IP Messenger is a LAN chat and file transmission tool with many advantages,

For example, data communication requires no server establishment, direct communication and data transmission between two computers, and supports transmission of files and directories, which is safe, fast, and convenient, therefore, many companies use it as a department or internal im tool.
In terms of program structure, IP Messenger adopts the Windows SDK processing structure, TCP/UDP communication mode, and file ing technology in file transmission processing. By analyzing the operation and working principle of IP Messenger, we can improve and deepen our understanding of the Windows processing process and socket programming technology. Therefore, we analyze the source code to give a reference, improve programming technology together.

1. Download IP Messenger source code

When writing this article, the latest version of IP Messenger is 2.06, so you should try to download the latest version when downloading. IP Messenger source code is http://www.ipmsg.org/, on the right corner of the site, click the English page, the site to the English interface, the site has English version and other languages, of course, there is a Chinese version of The Link (http://www.azhi.net/IPMsg ), we recommend that you download the source code of the original English version to facilitate your learning.

2. IP Messenger source code directory and file

For the directory structure and files of IP Messenger source code, see list 1.1 Main directories and files of IP Messenger source code:

List 1.1 Main directories and files of IP Messenger source code

Attribute

Name

Description

Directory

SRC

Project file source code and install directory

File

Ipmsg. Mak

The project files used in vc4 and earlier versions are used to specify how to create a project. vc6 converts the Mak file into a DSP file for processing.

Ipmsg. MDP

Suffix MDP (Microsoft
(Short for devstudio project) is a project file of the old version, which is equivalent to a DSP file.

PROT-ENG.TXT

English protocol description

Protocol. txt

Japanese version protocol description

Readme. txt

Readme in English

README-J.TXT

Japanese readme

The src directory of IP Messenger is described in list 1.2, src directory and main files.

Attribute

Name

Description

Directory

Install

Installer source code directory

File

Blowfish. cpp

Encryption Algorithm source file

Blowfish. h

Encryption Algorithm header file

Blowfish. H2

Encryption Algorithm random number header file

Cfg. cpp

System Configuration source file

Ipmsg. cpp

Ipmsg app source file

Ipmsg. h

Ipmsg header file

Logdlg. cpp

Log DLG source file

Logmng. cpp

Log processing source file

Mainwin. cpp

IP Messenger Main Window source file

Miscdlg. cpp

Message DLG, source files such as DLG and control subclass

Msgmng. cpp

Socket Management source file

Plugin. cpp

DLL plugin

Recvdlg. cpp

Received message processing source file

Senddlg. cpp

Source file for Sending Message Processing

Setupdlg. cpp

IP Messenger attribute configuration source file

Share. cpp

File Transfer receiving management source file

Tapp. cpp

Application class source file

Tdlg. cpp

DLG class source file

Tlist. cpp

Linked List source file

Tregist. cpp

Source file of registry operation class

Twin. cpp

Window class source file

Msgstr. h

String constant header file

Tlib. h

Class, structure, and other header files

In addition, there is an install directory under the src directory. The files in this directory are the source code of the IP Messenger Installer. The main file description is the main file in the 1.3 install directory in the list.

List 1.3 Main files in the install directory

Attribute

Name

Description

File

Install. cpp

Installer source file

Install. h

Installer header file

The above is the description of the main directory of IP Messenger and its main source files. We can clearly see the function distribution of IP Messenger through the list. In the following detailed analysis, we mainly focus on these source files.

3. Engineering conversion of IP Messenger source code

Since IP Messenger was written in a previous version of VC, You need to convert the project file to a vc6 version when opening the project file.
Double-click the ipmsg. MDP file and the system prompts you to convert the ipmsg. Mak project configuration file to the project file under vc6, as shown in.

Click "yes" to confirm the project to be converted to vc6. The system prompts you to convert the Mak project file to the DSP project file, as shown in.

Click OK. The system generates the ipmsg. DSP file and the ipmsg. DSW file under vc6 Based on the Mak file. In addition, the system generates the ipmsg. NCB and ipmsg. Opt files.

4. IP Messenger project configuration

The configuration of IP Messenger is somewhat different from that of the current vc6 project. The installation project files and project files are mixed together. Unlike the vc6 project files, different projects are under different projects, configure them separately.
Click the "build" menu and select "set active ".
Configuration ...", The "set active project" dialog box appears.
Configuration dialog box, as shown in.

There are 6 project configurations for IP Messenger, including the release English and Japanese, and the ipmsg project and installation project for debug. You can compile different projects by selecting different configurations. As needed, we select the ipmsg-Win32 debug configuration as the current active project, this compilation configuration can compile the debug version of ipmsg.
Click the "project" menu and select "Settings ...", In the "Project Settings" dialog box, select the "C/C ++" tab, as shown in.

 

As you can see, in "Preprocessor definition:", the project uses the "Japanese" macro definition, that is, the compiled debug version of ipmsg is Japanese. Of course, you can modify the macro to "English" as needed to compile the debug version of the English ipmsg.
Of course, in the future analysis, we will analyze the installation of ipmsg, then we should choose ipmsg-Win32
The installerdbg configuration is used as the current active project, and the installation project of the debug version is compiled.
The System Configuration Overview In this section ends here. The next section will analyze the system running framework and process of IP Messenger, and master the basic development ideas of windows through analysis and learning.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.