Can I receive, read and modify CRC and ACK using the socket
library in C lenguage?
Are there any ways I can use? I use Raspberry Pi and PiCan2.
I will assume that you're asking about TCP/IP, since UDP packets don't have ACK attached to them.
AFAIK, your only solution would be to use Linux's raw sockets and implement your own TCP layer (see WireShark), since CRC and ACKs shouldn't be available to the user level code.
CRC: You probably have enough data to calculate the CRC, as any CRC error would mean that the message would never arrive to the user application (the kernel will throw the packet). So you could re-calculate the CRC safely. As for writing a CRC,
ACK: Your application isn't notified about ACK packets, so you can't extract the data.
EDIT: (since the question was edited after I posted my answer)
Note that raw sockets aren't portable to all OS flavors, so your code won't be portable (this is one reason why the QUIC protocol uses UDP instead of raw sockets).
If you're running Linux on your Pi, you can use WireShark to review the traffic. Though it won't be available to your C program, it can make for a good debugging tool.