<nullnullnull>
dmbaturin, thanks mate :) I will look there
<hannes>
.but then gethostbyname hides the socket from you... .oO(what would you like to timeout, the connect or the getaddrinfo?)
<nullnullnull>
hmmm
<nullnullnull>
why not both? ;)
<hannes>
TL;DR: it's complicated. I don't know how you'd do it for gethostbyname. for connect, the TCP stack actually already has an established_timeout (but as dmbaturin pointed, you can setsockopt SO_RCVTIMEO)...
<nullnullnull>
can I do it with another way? like using threads timeout or anything related
<hannes>
nullnullnull: likely (but I'm not very knowledgable in programming with posix threads (+OCaml), sorry)
<nullnullnull>
hannes, btw I'm new to OCaml ;)
<dmbaturin>
In practice it should work for connect on most platforms I think.
<hannes>
nullnullnull: in case you plan to use lwt (an asynchronous task library -- http://ocsigen.org/lwt/4.1.0/api/Lwt) --> this one has Lwt.pick [ do_my_connection ; Lwt_unix.sleep 3. ]
<nullnullnull>
yeah I'm trying to not use any external library
carlosdagos has joined #ocaml
<nullnullnull>
I saw the "Lwt" and the "utop" thing but need to install the libraries
<Armael>
not sure if it's relevant for what you're trying to do, but https://ocaml.github.io/ocamlunix/ is a good resource wrt unix system programming in ocaml
<Armael>
damn.
<Armael>
dmbaturin was faster
<nullnullnull>
thanks guys :) I will learn from there
<Armael>
but generally speaking, for low level socket manipulation and the like, the ocaml APIs just mirror the unix ones
<Armael>
so I usually just google for solutions in C and the ocaml solution is a one-to-one adaptation
<Armael>
(or, as noted by hannes, you could use Lwt that provides higher level, asynchronous APIs)
<Armael>
but note that if you can do it in C without ptheads, you can do it in ocaml without threads as well
<Armael>
you can do something similar to your C snippet above
<nullnullnull>
hmm
<Armael>
it should work just the same
<nullnullnull>
thanks mate :) I will see
mfp has quit [Ping timeout: 245 seconds]
brett-soric has joined #ocaml
dmiles has joined #ocaml
dimitarvp has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
brett-soric has left #ocaml [#ocaml]
dimitarvp has quit [Quit: Bye]
RalfJ has quit [Remote host closed the connection]
RalfJ has joined #ocaml
dmiles has quit [Ping timeout: 258 seconds]
jnavila has joined #ocaml
dmiles has joined #ocaml
JimmyRcom has joined #ocaml
_whitelogger has joined #ocaml
Birdface has joined #ocaml
Birdface has quit [Remote host closed the connection]
mfp has joined #ocaml
nullnullnull has quit [Quit: Leaving]
FreeBirdLjj has joined #ocaml
carlosdagos has quit [Read error: Connection reset by peer]
carlosdagos has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 245 seconds]
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
slice has quit [Ping timeout: 250 seconds]
slice has joined #ocaml
cgt has joined #ocaml
rosterok has quit [Quit: Connection closed for inactivity]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
cgt has quit [Read error: Connection reset by peer]
cgt has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Serpent7776 has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
jnavila has quit [Ping timeout: 252 seconds]
oni-on-ion has quit [Ping timeout: 264 seconds]
ziyourenxiang_ has quit [Ping timeout: 246 seconds]
themsay has quit [Read error: Connection reset by peer]
themsay has joined #ocaml
AtumT has joined #ocaml
tane has joined #ocaml
louisg has quit [Ping timeout: 248 seconds]
Haudegen has joined #ocaml
Jeanne-Kamikaze has joined #ocaml
jnavila has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
louisg has joined #ocaml
jnavila has quit [Ping timeout: 246 seconds]
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
AtumT_ has joined #ocaml
AtumT has quit [Ping timeout: 248 seconds]
AtumT has joined #ocaml
AtumT_ has quit [Ping timeout: 248 seconds]
tane has quit [Quit: Leaving]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
ggole has quit [Quit: Leaving]
gravicappa has quit [Ping timeout: 246 seconds]
bitwinery has quit [Remote host closed the connection]
bitwinery has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
bitwinery has quit [Ping timeout: 248 seconds]
kakadu has quit [Remote host closed the connection]
bitwinery has joined #ocaml
liberiga has joined #ocaml
bitwinery has quit [Quit: Leaving]
oni-on-ion has joined #ocaml
Serpent7776 has quit [Quit: leaving]
Jesin has joined #ocaml
bluemanblue has joined #ocaml
<bluemanblue>
does anyone know an easy fix to this type error when trying to make any of the languages presented in Pierce's TPL (accompanying ocaml code)