Instead of porting the code over to C# byte for byte, look for equivalent functionality in the .NET framework.
The hostent structure is usually used to associate hostname and IP address.
For example ...
System.Net.IPAddress[] list = System.Net.Dns.GetHostAddresses("www.codeproject.com");