C + + game Server programming
C + + operating efficiency is very high
TCP Transmission Control Protocol
IP Internetwork Protocol
Socket
Linux Ubuntu
Open source third-party libraries
BOOST
80% game Server side with C + +
The hardest part of the work is the specific game logic.
Common game server frameworks and key parts of the implementation
IP Internetwork Protocol
The communication interaction model of OSI Model open system academic product
Application layer, presentation layer, session layer, Transport layer, network layer, link layer, physical layer
IP model
Produced in practice to be used as a standard
Encapsulation of data into the protocol stack
Ethernet Package minimum 46 bytes, less than 0
Maximum of 1500 bytes
IP protocol features: unreliable, no connection
There is no guarantee that the IP datagram will arrive at the destination successfully
Provide the best transfer service
The network data is transmitted according to the big endian.
IP Datagram Format header field
Home operating System Little endian
Most of the server side of the game with the TCP protocol
TCP Detailed
How TCP takes advantage of IP
TCP splits the application's transfer data into appropriate chunks
Timer
Delay Confirmation
Inspection and
Flow control
TCP encapsulates the data to be sent by the application
Tcp,ip There is no option, the header is 20 bytes.
TCP Header
The state transition of TCP
TCP connection Acknowledgement (three-time handshake)
Unidirectional link list reversal (study pointer)
struct Node
{
Node* Next;
int value;
}
Static node* reverselist (node* N) {
node* prev= nullptr;
while (n) {
node* next=n->next;
n->next=prev;
Prev=n;
N=next;
}
N=prev;
return n;
}
C + + Game Server Programming Learning notes (i)