3 ms·
> yet there is no standard way to open a TCP socket. The 'standard way' to create a TCP client socket in Clojure: (java.net.Socket. ^String host (int port
by lispm 10y ago
> yet there is no standard way to open a TCP socket.
The 'standard way' to create a TCP client socket in Clojure:
(java.net.Socket. ^String host (int port))
For the .net version:
(System.Net.Sockets.TcpClient. ^String host (int port))
It directly calls the functionality from the platform it is hosted on.
- pjlegato 10y agoYes. That's the point. The one standard way to open a TCP socket is with java.net.Socket. Common Lisp, on the other hand, has no such standard way, as TCP was not common when it was designed. It relies on a hodgepodge of poorly documented third party libraries, or vendor-specific extensions to do this. Clojure is, by definition, a JVM hosted language. The .net version is non-canonical.
- lispm 10y ago^> The one standard way to open a TCP socket is with java.net.Socket. So Clojure the language has no documented standard way to open a socket. One has to use the host environment (JVM, .net, ...) interface to do so. It means also that Clojure/JVM source code trying to open a socket will not run on Clojure/CLR without changes. That's not a 'standard'. It's the definition of 'implementation specific'. That's different from SBCL, which has a documented and maintained way to create sockets, which works similar over all the platforms it runs on - natively. http://www.sbcl.org/manual/#Networking http://www.sbcl.org/manual/#Networking For a portable way to create sockets over many Common Lisp implementations use usocket: https://common-lisp.net/project/usocket/ https://common-lisp.net/project/usocket/