How to use scheme

Continuing my quest to learn Redox internals and Rust, I am looking at how schemes work particularity with networking. I have a qemu network running with the default IP address from the Makefile and when I ping 10.58.58.2 I get

Recv 44 2001 0152C048 40
Recv 88 2001 0152C08C 40
Recv CC 2001 0152C0D0 40

So I know packets are receiving.

Looking at the wiki on network schemes I should access TCP with tcp:/// scheme but I am not clear on how to do this. Is there a simple example for creating a tcp connection, or using schemes in general? Also looking at main.rs for TCP or ethernet.rs it is not clear how to set subnet mask or gateway.

Sorry if things aren’t there yet, just trying to learn.

2 Likes

The tcp: scheme can be used to read/write from the TCP stream. It is actually not more complex than that, reading N bytes will simply poll N bytes from the TCP stream. Writing will simply send a package.

set subnet mask or gateway.

You can pass bit flags when opening the scheme! See mode.

I agree that the docs on TCP are quite limited right now. And this is certainly something we can improve on.

For a more general introduction to scheme, refer to the chapter in the book.

1 Like

Thanks that’s enough to get me experimenting

Let me know if you manage to get something working, I’m trying to do the same thing as you but no luck so far.

TCP: is not enabled right now. I can get it up and working, but it will take some time.

I am sure that you have a long list to tasks and to-do’s, but it would be nice to have a working low level network stack. Once the basics are working I am happy to take on higher level networking services like DNS/DHCP.