Im over socket between Windows Mobile Devices

Source: Internet
Author: User

The article "using WiFi to build an ad-hoc Network on Windows Mobile" describes how to use wifi to build an ad-hoc Network on Windows Mobile, the demo is provided on Windows Mobile 6 and Windows Mobile 2003se for Pocket PC. So what functions can a point-to-point Ad-Hoc network accomplish? On the one hand, it can be used to send and receive messages in real time, also known as IM (Instant Messager); on the other hand, it can be used to send files. This articleArticleLet's talk about how to use socket to Implement IM between Windows Mobile devices (in fact, after synchronization between Windows Mobile devices and PCs, you can use socket to implement communication with PCs. For details, refer to the fox blog: windows Mobile's simple im program (socket via C #)).

1. Applications are divided into server and client, and applications are written.ProgramFor more information, see Chapter 9th and Chapter 11th of EVC advanced programming and application development.Source codeYou can download it at http://www.waterpub.com.cn.

2. the development environment is Visual Studio 2008 + Windows Mobile 2003 for Pocket pc sdk + Windows Mobile 6 pro SDK, which is developed using MFC.

3. When creating a project, select Windows Sockets in the advanced features option to add socket support. As shown in 1:

Figure 1: Add Windows Sockets support

4. Design a simple UI on the server and client, as shown in Figure 2:

Figure 2: simple UI on the server and client

5. Add variable to add member variables for the control.

6. refer to section 11th of EVC advanced programming and application developmentCodeWrite. The file composition of the server and client is shown in 3:

Figure 3: Composition of files on the server and client

7. On the client side, the ctcpclient_ce class encapsulates tcp client operations, then calls the class to establish a connection with the TCP server in the dialog box, transmits data, and finally disconnects the server. On the server side, the ctcpserver_ce class is responsible for listening to client connections. Once the client has a connection request, it is responsible for receiving the connection and creating a new ctcpcustom_ce object to communicate with the client. The ctcpserver_ce class then listens to client connection requests.

8. Code test. Use wifi to build an ad-hoc Network on Windows Mobile. Run the server program on the Windows Mobile 2003se for Pocket PC and the client program on the Windows Mobile 6 Professional device, as shown in Figure 4:

Figure 4: Device Test

Note: Both the server and client use asynchronous socket communication.

Finally, put the source code and download it from here: tcptest.rar, which is useful to everyone.

 

Reference link:

1. using WiFi to build an ad-hoc Network on Windows Mobile

2. Simple im program for Windows Mobile (socket via C #)

3. EVC advanced programming and application development

Related Article

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.