Phil,
fun socketToInt s = SysWord.toInt( Posix.FileSys.fdToWord( valOf(Posix.FileSys.iodToFD(Socket.ioDesc s))));
val s: (Socket.active Socket.stream) INetSock.sock = INetSock.TCP.socket();
socketToInt s;
This will only work on Unix since the Posix structure isn't available on Windows. Yes, it is quite long-winded.
David
On 30/07/2016 23:35, Phil Eaton wrote:
I've come to in impasse with Ponyo trying to access common REST APIs. I've gotten this far ignoring SSL but it's time to start attacking that. Has anyone done any work on SSL/TLS in Standard ML? I could not find anything on SML/NJ and MLton email archives (and couldn't find a reasonable way to search Poly/ML's).
It seems like the Socket module makes the underlying socket int pointer completely opaque. Since that pointer is what you'd need to make the tls call to wrap it in a tls context, it seems like it won't be possible to use the Socket module. I hope I am mistaken because otherwise the necessary step will be to reimplement the Socket module functionality in Ponyo.
Any thoughts or suggestions on moving forward?
The problem is that the socket is not necessarily an int. In Windows it's a UINT_PTR that is actually a Windows Handle. That all gets hidden in the run-time system in Poly/ML and the value that is passed back to the ML code is a