WinSocket LAN Chat software how to run?

Source: Internet
Author: User
Tags socket thread

Program Implementation function:

LAN chat software, start to find online devices, and can carry out simple text chat.

In fact, the following diagram has explained the most functional principles of the program.

Program diagram of Core class

I think the best technique to use in this program is IOCP. In the back I will write a blog for IOCP, this technology although just learned a bit messy, but it is very useful.

The event completion in the middle of the udpserver thread in the above diagram is the event that the Mainserver thread sets after the Listen function call ends. I forgot to mark it here.

  Description

A few days ago in the laboratory to see "Windows Network and Communication program design" this book, after reading the first 5 chapters, I feel that the current technology to do a LAN chat software should be almost. Although there are a lot of details of things are not very understand, but to do a small size of software, I think it is not a problem. In this way, after about 4 days, that is, 18th this month, this Lanchat program was born ~

First of all, I declare: because I first write network-related programs, so there must be negligence, in the relevant aspects must be a lot of bugs, in addition, I often encountered in the test when the failure of the program startup, and the reason has not been identified. So I don't guarantee the stability and security of this program. (as the designer of this program is really ashamed ~ will be good later)

Another code in the large analysis of the structure function, after all, the initial realization of the time is not clear to realize and its function, so there is no scruple to release this piece of resources. For example, the chat window creates this piece and I don't use delete.

The multithreading section involves access to the data, so I use the key segment: CriticalSection structure and related functions.

Because this document is written in the bedroom, there is no online device, can not open the Chat window, in the lab three computers between the use of no problem.

In addition, Winsock2 initialization is selected in the project, in the console class, such as the application of the socket program must be done before the relevant initialization and library, file contains work.

Socket use program first attempt.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.