转换C到C# [英] converting C to C#

查看:665
本文介绍了转换C到C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这款C code转换为C#中,有一个C#等同于C工会的typedef?

I'm trying to convert this C code to C#, is there a C# equivalent to the C union typedef?

struct sockaddr_in {
    short   sin_family;
    u_short sin_port;
    struct  in_addr sin_addr;
    char    sin_zero[8];
};

typedef struct in_addr {
  union {
    struct {
      u_char s_b1,s_b2,s_b3,s_b4;
    } S_un_b;
    struct {
      u_short s_w1,s_w2;
    } S_un_w;
    u_long S_addr;
  } S_un;
 } IN_ADDR, *PIN_ADDR, FAR *LPIN_ADDR;

感谢。

推荐答案

您可以检查出的以下页面。这是说,在.NET你有课,让您直接与插座和TCP / IP,如插座,的TcpListener,TcpClient的工作,你不需要翻译C $ C $Ç盲目。

You may check out the following page. This being said, in .NET you have classes that allows you to work directly with sockets and TCP/IP such as Socket, TcpListener, TcpClient and you don't need to translate C code blindly.

这篇关于转换C到C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆