OK. So we can use Socket::SockAddr_In. SockAddr_In#offset_of gives offset of sockaddr_in* fields. But i don't known how to get their size.