Working thorough Iron lib


#1

Hi everyone.
I’m trying to make my Iron server public(to be accessable by my machine’s ip) and found that std::net::TcpStream could help me as : it is
A structure which represents a TCP stream between a local socket and a remote socket according to the documentation. So i ve got next:

let mut con=TcpStream::connect(“192.88.4.40:8181”).unwrap();
Iron::new(routing).http(con).unwrap();

but got:

^^^^ the trait std::net::ToSocketAddrs is not implemented for std::net::TcpStream
According to the compiler i have to impl ToSocketAddrs for TcpStream
but ive got lost trying to do it.
Can anyone help me out with it?
And is this approach correct in achieving the goal?


#2

Iron creates the TcpStream for you using a socket address you provide (via the http() method). You’re probably looking for this:

Iron::new(routing).http(“192.88.4.40:8181”).unwrap();

#3

I wished it work. But it didnt. The server is not accessible by my ip with
such syntax. I swam across the sea of info about iron server but only
localhost examples. Not a word about public server.


#4

I think you want to use "0.0.0.0:8181".


#5

No guys, I was a milk drinker and didn’t know that i had to turn the ip-routing and Wins-proxy on, to provide a server service. GIGGLING , I ve spent almost a week to solve a problem, terrorising people, and everything was solved just in a few clicks. SORRY GUYS.