How to check if the sender of a udp packet is authenticated? I think sending an authorization token in each packet is slow. So my second implementation is this: the network part will consist of one server and clients. Using the TCP, the client logs in to the server and receives the secret session key and the ID of the client's account (himself). Then, in every udp request to the server, the client should be able to insert the unencrypted ID at the beginning of the packet and encrypt the rest of the packet (the payload) with the secret key. And the server would already look for the secret key by the client's ID and decrypt the message. It turns out a kind of authentication. If you send id + unencrypted data, then after decrypting, the server will receive incorrect data and therefore will not process the request. But in this method, it takes time to transfer the ID and decrypt/encrypt the data. I also thought about this: first, the client logs in to the server and the server puts its IP in the list of clients. Every minute, let the client must send any packet to the server, otherwise it is removed from the list. But as far as I know, IP can be faked in the udp protocol, so in any case you have to encrypt the message. Is there a safe wayit possible to prevent thisnot encrypt the message at all?