1

As far as I understand source code, net device is already prepared fot UDP, but how to make UDP scheme?

Graham Chiu
  • 4,856
  • 1
  • 23
  • 41

1 Answers1

0

In this line of the source https://github.com/rebol/r3/blob/master/src/core/c-port.c#L612, the comments say

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.

I think the first instruction refers to mezz/sys-ports.r. So, we have this example https://github.com/rebol/r3/blob/master/src/mezz/sys-ports.r#L254, we could add something like

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]
]

You would then have to write an INIT_UDP_SCHEME like this one for TCP https://github.com/rebol/r3/blob/master/src/core/p-net.c#L299 where TCP_Actor starts here https://github.com/rebol/r3/blob/master/src/core/p-net.c#L92, and then initialize it here https://github.com/rebol/r3/blob/master/src/core/c-port.c#L626

And as you say, the UDP does seem to be otherwise ready.

Graham Chiu
  • 4,856
  • 1
  • 23
  • 41