We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 224866d commit c57fe69Copy full SHA for c57fe69
fortanix-vme/tests/outgoing_connection/src/main.rs
@@ -1,8 +1,12 @@
1
-use std::net::TcpStream;
+use std::net::{Ipv4Addr, TcpStream};
2
use std::io::{Read, Write};
3
4
fn main() {
5
let mut socket = TcpStream::connect(format!("google.com:80")).unwrap();
6
+ // `socket.local_addr()` may return the actual local IP address, not 127.0.0.1
7
+ assert!(socket.local_addr().unwrap().port() != 80);
8
+ assert!(socket.peer_addr().unwrap().ip() != Ipv4Addr::new(127, 0, 0, 1));
9
+ assert_eq!(socket.peer_addr().unwrap().port(), 80);
10
socket.write(b"GET / HTTP/1.1\n\n").unwrap();
11
socket.flush().unwrap();
12
let mut page = [0; 4192];
0 commit comments