Right now I am porting a VB6 project over to C# and keep getting this error. Can't seem to fix it in the namespace.
Problem:
//Expected class, delegate, enum, interface, or struct
public string GetHostByAddress(long addr)
{
dynamic phe = null;
dynamic Ret = null;
HOSTENT heDestHost = default(HOSTENT);
dynamic hostname = null;
phe = gethostbyaddr(addr, 4, PF_INET);
if (phe) {
MemCopy(heDestHost, phe, hostent_size);
hostname == new String[256, 0];
MemCopy(hostname, heDestHost.h_name, 256);
GetHostByAddress == Strings.Left(hostname, Strings.InStr(hostname, Strings.Chr(0)) - 1);
} else {
GetHostByAddress = WSA_NoName;
}
}
Original Method looks like this.
Public Function GetHostByAddress(ByVal addr As Long) As String
Dim phe&, Ret&
Dim heDestHost As HOSTENT
Dim hostname&
phe = gethostbyaddr(addr, 4, PF_INET)
If phe Then
MemCopy heDestHost, ByVal phe, hostent_size
hostname = String$(256, 0)
MemCopy ByVal hostname, ByVal heDestHost.h_name, 256
GetHostByAddress = Left$(hostname, InStr(hostname, Chr$(0)) - 1)
Else
GetHostByAddress = WSA_NoName
End If
End Function
Failing to understand why its not working and getting frustrated. Any Suggestions?