【发布时间】:2013-03-29 09:54:08
【问题描述】:
据我了解的源码,net device已经准备好支持UDP了,但是如何制作UDP方案呢?
【问题讨论】:
据我了解的源码,net device已经准备好支持UDP了,但是如何制作UDP方案呢?
【问题讨论】:
在源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 似乎已经准备好了。
【讨论】: