mpcref
mpcref3w ago

Use deno serve for tcp

I like deno serve especially because it has a --parallel flag. I would like to use this to spawn parallel plain tcp/uds socket servers. But as far as I can tell this method can only be used for http servers. Am I correct? Is there a different elegant solution to accomplish this?
2 Replies
marvinh.
marvinh.3w ago
yes, you're correct. iirc Deno.connect() is the way to go for tcp stuff but it doesn't have the automatic threading that deno serve --parallel gives you
lcasdev
lcasdev2w ago
@mpcref On Linux you can spawn multiple Deno processes and listen with Deno.listen with the reusePort option set to true. The Kernel will then round robin (more or less) between the different Deno processes

Did you find this page helpful?