As far as I understand source code, net device is already prepared fot UDP, but how to make UDP scheme?
Asked
Active
Viewed 232 times
1 Answers
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
-
thanks Graham, net device must be switched to UDP first see reb-net.h socket_types, but main question is if the actor would be the same as for TCP or completely different – user2223887 Apr 01 '13 at 07:04
-
UDP is now implemented – Graham Chiu Sep 04 '15 at 06:44