Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding socket functionality #739

Open
snapo opened this issue Nov 20, 2024 · 1 comment
Open

Adding socket functionality #739

snapo opened this issue Nov 20, 2024 · 1 comment
Labels
enhancement New feature or request prelude Bend's builtin types and functions

Comments

@snapo
Copy link

snapo commented Nov 20, 2024

Sometime you need external data/ events whatever.... is there a way to use sockets?

for example:
IO/Socket/open (addr: String, port: u24) -> u24
IO/Socket/send (socket: u24, bytes: List(u24)) -> IO Result(u24)
IO/Socket/recv (socket: u24, max_bytes: u24) -> IO Result(List(u24))
IO/Socket/close (socket: u24) -> IO None

this would allow then to
socket <- IO/Socket/open("127.0.0.1", 8080)

  • <- IO/Socket/send(socket, String/encode_utf8("Hello, World!"))
    response <- IO/Socket/recv(socket, 1024)
  • <- IO/Socket/close(socket)

(what i dont get is , if the code runs then on the GPU, there would always have to be a read/write object or a socket between gpu und the socket that runs on the cpu....)

is there anything planned? or did i overlook something?

@developedby
Copy link
Member

It is planned, but a bit further down the line. You can of course implement it yourself as an FFI extension, although that's a bit annoying at the moment.

The socket part would be outside the runtime and not run on the GPU.

@developedby developedby added enhancement New feature or request prelude Bend's builtin types and functions labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prelude Bend's builtin types and functions
Projects
None yet
Development

No branches or pull requests

2 participants