File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -25,21 +25,23 @@ pub fn run(port: u16, pwd: String) {
2525 ( pk >> ( 1 * 8 ) ) as u8 ,
2626 pk as u8 ,
2727 ] ;
28- let ( tx4, rx) = channel :: < TcpStream > ( ) ;
29- let tx6 = tx4. clone ( ) ;
30- std:: thread:: spawn ( move || {
31- let listener_ipv4 = TcpListener :: bind ( format ! ( "0.0.0.0:{}" , port) ) . unwrap ( ) ;
32- for sr in listener_ipv4. incoming ( ) {
33- match sr {
34- Ok ( stream) => {
35- tx4. send ( stream) . unwrap ( ) ;
36- }
37- Err ( e) => {
38- println ! ( "error {}" , e) ;
28+ let ( tx6, rx) = channel :: < TcpStream > ( ) ;
29+ if cfg ! ( target_os = "windows" ) {
30+ let tx4 = tx6. clone ( ) ;
31+ std:: thread:: spawn ( move || {
32+ let listener_ipv4 = TcpListener :: bind ( format ! ( "0.0.0.0:{}" , port) ) . unwrap ( ) ;
33+ for sr in listener_ipv4. incoming ( ) {
34+ match sr {
35+ Ok ( stream) => {
36+ tx4. send ( stream) . unwrap ( ) ;
37+ }
38+ Err ( e) => {
39+ println ! ( "error {}" , e) ;
40+ }
3941 }
4042 }
41- }
42- } ) ;
43+ } ) ;
44+ }
4345 std:: thread:: spawn ( move || {
4446 let listener_ipv6 = TcpListener :: bind ( format ! ( "[::0]:{}" , port) ) . unwrap ( ) ;
4547 for sr in listener_ipv6. incoming ( ) {
You can’t perform that action at this time.
0 commit comments