Ip message in ip protocol header. When tcp protocol receive a packet, it only has a tcp header, and there is no ip address. Why can we get client's ip address from a socket.
TCP is based on IP: it uses IP packets to carry data around the Internet. More specifically, the whole TCP packet is fitted into an IP packet's body before being sent.
So you won't find the IP address in the TCP packet because such information belongs to the IP packet. When the client receives a TCP segment, it receives it inside an IP packet containing the IP address.