Last active
February 10, 2016 08:24
-
-
Save Ismael-VC/3b517d02a3e7e7a90d80 to your computer and use it in GitHub Desktop.
Julia plot server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
port = begin | |
try | |
parse(Int, ARGS[1]) | |
catch err | |
error("usage: `$ julia server.jl <port>`") | |
end | |
end | |
info("loading Gadfly...") | |
tic(); using Gadfly; toc() | |
info("JIT warmup...") | |
tic() | |
draw(SVG("output_0.svg", 6inch, 3inch), plot([sin, cos], 0, 25)) | |
toc() | |
server = listen(port) | |
info("listening on port: $port") | |
while true | |
conn = accept(server) | |
@async begin | |
try | |
while isopen(conn) | |
eval(parse(readline(conn))) | |
end | |
catch err | |
println("Connection ended with error: $err") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
First run, ie:
Then on another terminal: