Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind connection to particular ip address #43

Open
ivandbarron opened this issue Jul 10, 2015 · 0 comments
Open

Bind connection to particular ip address #43

ivandbarron opened this issue Jul 10, 2015 · 0 comments

Comments

@ivandbarron
Copy link

I copy/paste Morsel example application (but change port number):

using Morsel
app = Morsel.app()
route(app, GET | POST | PUT, "/") do req, res
    "This is the root"
end
get(app, "/about") do req, res
    "This app is running on Morsel"
end
start(app, 8080)

but because it's deployed in redhat openshift environment it fail with next error:

ERROR: I/O object not initialized

Going deeper i try with a socket server in same environment (without Morsel):

server = listen(8080)
while true
  conn = accept(server)
  @async begin
    try
      while true
        line = readline(conn)
        println(line)
        write(conn, line)
      end
    catch ex
      print("connection ended with error $ex")
    end
  end
end

failed again:
ERROR: cannot bind to port, may already be in use or access denied

but after i use ip address that openshift specify in environment var $OPENSHIFT_JULIA_IP, it works without problems, every time:

server = listen(ip"xxx.x.xxx.xxx", 8080)   
...
# always works!! 

is possible bind to particular ip address?

app = Morsel.app(ip"xxx.x.xxx.xxx") # maybe ?
...
start(app, ip"xxx.x.xxx.xxx", 8080) # maybe here :) ?
@ivandbarron ivandbarron changed the title Is possible specify ip address in start function? Is possible specify ip address? Jul 10, 2015
@ivandbarron ivandbarron changed the title Is possible specify ip address? Bind connection to particular ip address Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant