"By C Toss series" with C-tone DIOCP coded client communication

Source: Internet
Author: User

A few days ago a friend, said their company to do hand-tour, service end with DIOCP3 inside do file server, client with Cocos-x, in debugging and DIOCP communication always fail!

So, I downloaded a codeblocks after a few hours of tossing, finally toss out, put some of the sad record, in order to consult later.

1.windows when using some of the socket's functions, you need to set the project options or the tool's compilation options

[project–> build Options]->[linker Settings] or [Setting]->[complier]->linker settings] Add

F:\TOOLS\C\CODEBLOCKS\MINGW\LIB\*.A to [link libraries]

Otherwise, a compilation error will occur.

undefined reference to '[email protected]'

2. about extern and Static in C

Baidu above there are more explanations,

extern represents a decorated function or variable that is referenced from another file. (extern tells the compiler that this variable or function is already defined in other files.)

Static represents a modified function or variable that can only be used in this file. Static can also decorate a local variable, which indicates that the variable is not available after exiting the function, but when it enters the function again, the variable saves the previous value.

The following is the debug

The above describes a communication with the server, the server receives a specific encoding format (Flag + checkvalue + datalen + data)

After sending the past, the service side will be encoded back as it is.

Summarize:

Contact with another language, need to write more code, only in the process of writing will encounter problems, solve problems, accumulate experience in the pit. Ideas and ideas have, and the rest is more than a pit point on the good

"By C Toss series" with C-tone DIOCP coded client communication

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.