@@ -4,7 +4,7 @@ use crate::hash;
4
4
use crate :: io;
5
5
use crate :: iter;
6
6
use crate :: mem;
7
- use crate :: net:: { hton , ntoh , IpAddr , Ipv4Addr , Ipv6Addr } ;
7
+ use crate :: net:: { htons , ntohs , IpAddr , Ipv4Addr , Ipv6Addr } ;
8
8
use crate :: option;
9
9
use crate :: slice;
10
10
use crate :: sys:: net:: netc as c;
@@ -276,7 +276,7 @@ impl SocketAddrV4 {
276
276
SocketAddrV4 {
277
277
inner : c:: sockaddr_in {
278
278
sin_family : c:: AF_INET as c:: sa_family_t ,
279
- sin_port : hton ( port) ,
279
+ sin_port : htons ( port) ,
280
280
sin_addr : * ip. as_inner ( ) ,
281
281
..unsafe { mem:: zeroed ( ) }
282
282
} ,
@@ -326,7 +326,7 @@ impl SocketAddrV4 {
326
326
/// ```
327
327
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
328
328
pub fn port ( & self ) -> u16 {
329
- ntoh ( self . inner . sin_port )
329
+ ntohs ( self . inner . sin_port )
330
330
}
331
331
332
332
/// Changes the port number associated with this socket address.
@@ -342,7 +342,7 @@ impl SocketAddrV4 {
342
342
/// ```
343
343
#[ stable( feature = "sockaddr_setters" , since = "1.9.0" ) ]
344
344
pub fn set_port ( & mut self , new_port : u16 ) {
345
- self . inner . sin_port = hton ( new_port) ;
345
+ self . inner . sin_port = htons ( new_port) ;
346
346
}
347
347
}
348
348
@@ -368,7 +368,7 @@ impl SocketAddrV6 {
368
368
SocketAddrV6 {
369
369
inner : c:: sockaddr_in6 {
370
370
sin6_family : c:: AF_INET6 as c:: sa_family_t ,
371
- sin6_port : hton ( port) ,
371
+ sin6_port : htons ( port) ,
372
372
sin6_addr : * ip. as_inner ( ) ,
373
373
sin6_flowinfo : flowinfo,
374
374
sin6_scope_id : scope_id,
@@ -420,7 +420,7 @@ impl SocketAddrV6 {
420
420
/// ```
421
421
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
422
422
pub fn port ( & self ) -> u16 {
423
- ntoh ( self . inner . sin6_port )
423
+ ntohs ( self . inner . sin6_port )
424
424
}
425
425
426
426
/// Changes the port number associated with this socket address.
@@ -436,7 +436,7 @@ impl SocketAddrV6 {
436
436
/// ```
437
437
#[ stable( feature = "sockaddr_setters" , since = "1.9.0" ) ]
438
438
pub fn set_port ( & mut self , new_port : u16 ) {
439
- self . inner . sin6_port = hton ( new_port) ;
439
+ self . inner . sin6_port = htons ( new_port) ;
440
440
}
441
441
442
442
/// Returns the flow information associated with this address.
0 commit comments