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