c# c++ 之间网口通信 结构体 转换

下面是 C++的结构体 转换成 C# 怎么写 真心不懂 请附上值 把 IP 端口那些 都填上
/*Structure used in select() call,taken from the BSD file sys/tim.h.*/
struct timeval{
long tv_sec; /*seconde*/
long tv_usec; /*and microseconds*/
}

/*Socket address,internet style.*/
struct sockaddr_in{
short sin_family;
u_short sin_port;
char sin_zero[8];
}

/*The new type to be used in all. instances which refer to sockets*/
typedef UINT_PTR SOCKET;

真心不懂 请尽量详细点

int _stdcall ConnectNetPort(SOCKET *lpSocket,//传入已分配套接字的指针
SOCKADDR_IN * pPrinterAddr, //打印机的地址
timeval *lpTimeout); //超时
功能说明:
调用该函数将会连接打印机。成功返回1,失败返回值见下:
-1:创建套接字失败。
-2:设¦为非阻塞模式失败。
-3:连接超时。
-4:Select错误

这个是一个网口热敏打印机的

  [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct timeval{
int tv_sec; /*seconde*/
int tv_usec; /*and microseconds*/
}
/*Socket address,internet style.*/
 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct sockaddr_in{
short sin_family;
ushort sin_port;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
string sin_zero[8];
}

/*The new type to be used in all. instances which refer to sockets*/
typedef UINT_PTR SOCKET;

这个别漏了

typedef UINT_PTR SOCKET;
这个有没有无所谓