【问题标题】:How to implement UDP scheme in Rebol3如何在 Rebol3 中实现 UDP 方案
【发布时间】:2013-03-29 09:54:08
【问题描述】:

据我了解的源码,net device已经准备好支持UDP了,但是如何制作UDP方案呢?

【问题讨论】:

    标签: rebol rebol3


    【解决方案1】:

    在源https://github.com/rebol/r3/blob/master/src/core/c-port.c#L612的这一行,cmets说

    In order to add a port scheme: 
    In mezz-ports.r add a make-scheme. 
    Add an Init_*_Scheme() here. 
    Be sure host-devices.c has the device enabled.
    

    我认为第一条指令是指 mezz/sys-ports.r。所以,我们有这个例子https://github.com/rebol/r3/blob/master/src/mezz/sys-ports.r#L254,我们可以添加类似的东西

    make-scheme [
      title: "UDP Networking"
      name: 'udp
      spec: system/standard/port-spec-net
      info: system/standard/net-info ; for C enums
      awake: func [event] [print ['UDP-event event/type] true]
    ]
    

    然后您必须为 TCP https://github.com/rebol/r3/blob/master/src/core/p-net.c#L299 编写一个像这样的 INIT_UDP_SCHEME,其中 TCP_Actor 从这里开始 https://github.com/rebol/r3/blob/master/src/core/p-net.c#L92,然后在此处初始化它 https://github.com/rebol/r3/blob/master/src/core/c-port.c#L626

    正如你所说,UDP 似乎已经准备好了。

    【讨论】:

    • 感谢 Graham,必须先将网络设备切换到 UDP,请参阅 reb-net.h socket_types,但主要问题是参与者是与 TCP 相同还是完全不同
    • UDP 现已实现
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-11
    相关资源
    最近更新 更多