Since he's using C++ he probably wants to stick to native code, which means he'd be better off using Rust.
Unfortunately I seem to get the same request timeout error.Code:use std::io::net::tcp::TcpStream; use std::io::{IoResult, BufferedWriter}; fn do_stuff() -> IoResult<String> { let username = "foo"; let password = "bar"; let nexon_host = "passport.nexoneu.com"; let nexon_uri = "/Service/Authentication.asmx/Login"; let mut nexon_sock = try!(TcpStream::connect(nexon_host, 80)); let mut nexon_writer = BufferedWriter::new(nexon_sock.clone()); let body = format!(r#"{{"account":{{"userId":"{}","password":"{}","accessedGame":"MapleStory","captcha":"","isSaveID":true}}}}"#, username, password); try!(write!(nexon_writer, "POST {} HTTP/1.0\r\n", nexon_uri)); try!(write!(nexon_writer, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)\r\n")); try!(write!(nexon_writer, "Content-Type: application/json\r\n")); try!(write!(nexon_writer, "Content-Length: {}\r\n", body.len())); try!(write!(nexon_writer, "Host: {}\r\n\r\n{}", nexon_host, body)); try!(nexon_writer.flush()); nexon_sock.read_to_string() } fn main() { println!("{}", do_stuff()); }
Someone recently showed me the C# implementation:
You must be registered to see links
However, I'm really not used to HTTP-requests, and hence I don't know how to do the cookie-jar part.