The Crystal programming language | http://crystal-lang.org | Fund Crystal's development: http://is.gd/X7PRtI | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/
spawn
block so that it doesn't block the rest of the program. Then later I'm trying to close it with the #close
function outside of the spawn
block later on. However despite that it still leaves the socket open and listening. I'm assuming it needs to be closed within the spawn
block but I'm wondering if anyone has some insight on that.
@rishavs:
I just want crystal on windows so I can do some gamejams using crsfml ^_^. I am not interested in the networking bits, just hate the effort it requires to set up crystal on windows currently.
i have to say, a one-time hurdle that takes up an hour at most doesn't seem reasonable to give up at, considering how big of a followup you're abstaining from.
master
Before and after close
p http.@sockets.map(&.closed?) p http.@sockets # or
@didactic-drunk it's actually returning empty arrays for me before and after. It's kind of odd. Maybe something is happening after the #listen
method that is causing some issue?
# Before Close
[]
[]
# After Close
[]
[]
@aaaScript Empty
@sockets
explains whyclose
doesn't work.p @sockets
before & afterbind
&listen()
. The array probably gets nuked afterlisten
or it wouldn't accept connections at all
@didactic-drunk It returns socket output after bind_tls
and listen
as expected. However, it just seems to get wiped like you mentioned. It's kind of weird. I'm not overwriting the object or anything.