Message Boards Message Boards

CSockets: Creating fast server for TCP/HTTP/custom protocols

Posted 1 year ago

enter image description here

POSTED BY: Kirill Belov
5 Replies

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD

Nice post Kirill. Wondering if you've seen this repo I wrote a few years back:

https://github.com/arnoudbuzing/wolfram-server

POSTED BY: Arnoud Buzing
Posted 1 year ago

Thank you very much for the praise! Yes, of course I've seen your repository. I'm subscribed to you on github ;-). In return, I can give you a link to my 2017 article where I also made a server on WL. https://habr.com/ru/companies/wolfram/articles/320196/

POSTED BY: Kirill Belov

Thanks for the link ...

When you do:

server1 = SocketOpen[8001] 

it opens a socket using a very old kernel TCP socket implementation (which probably should be removed at this point. I would suggest to always use "ZMQ" in the second argument, or {"ZMQ", type} for specific connection type.I don't know if this makes any difference in speed, but I would expect this to be the more long-term supported syntax for sockets.

POSTED BY: Arnoud Buzing
Posted 1 year ago

I investigated the source code of the embedded library that implements sockets - as far as I understand both ZMQ and TCP type sockets use the same zeromq library. I didn't try to use ZMQ type sockets in my applications as I needed the server to run on pure TCP as I implemented HTTP and WebSocket protocols. As I wrote above - they worked slowly and unstable and in the end I made my implementation in C. As far as I managed to understand the whole problem was in the zeromq library. By the way, Leonid Shifrin advised me to make my own implementation too, because zeromq has many problems of its own. But the most unpleasant thing is that I have no control over what happens there, because it is a third-party library of a third-party developer.

POSTED BY: Kirill Belov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract