Thread synchronization is implemented in 1,objective-c:
Mutexlock (mutex), Nscondition Lock (conditional lock) Message delivery
2,UDP and TCP:
TCP: Transmission Control Protocol, which provides connection-oriented, reliable, point-to-point communication.
UDP: User Packet protocol. Providing non-connected unreliable point-to-multipoint communication is a connectionless transport-layer protocol in the OSI Reference model that provides simple, unreliable information transfer for transactions.
3,TCP/IP the process of establishing a connection:
In the TCP/IP protocol, the TCP protocol provides a reliable connection service, using three-time handshake to establish the connection;
First handshake: When the connection is established, the client sends a connection request to the server and enters the Syn_send state, waiting for the server to confirm;
Second handshake: The server receives a client connection request and sends an allow connection reply to the client, at which point the server enters the SYN_RECV state;
Third handshake: The client receives the server's allow connection reply, sends the acknowledgement to the server, the client and the server enter the communication state, and completes three handshake.
(The so-called three-time handshake, is to have three times the connection information of the sending, receiving process.) The establishment of TCP connections requires the sending and receiving of three connection information. )
4, a global variable can be defined in a header file that is contained by multiple. c files, declaring a global variable with the same name in static form in a different C file. The precondition is that only one of the C files can have the initial value assigned to this variable, and the connection will not be faulted at this time.
5, referencing a global variable that has already been defined:
- extern keyword
- You can also use the method of referencing the header file.
If you refer to a header file by reference to a global variable in the header file, assuming that your variable is wrong, then the compilation will be error, if you use the Extern method, if you make the same error, you will not error during compilation, and error during the connection.
Objective-c Related knowledge points