@@ -4,7 +4,7 @@ use crate::hash;
44use crate :: io;
55use crate :: iter;
66use crate :: mem;
7- use crate :: net:: { hton , ntoh , IpAddr , Ipv4Addr , Ipv6Addr } ;
7+ use crate :: net:: { htons , ntohs , IpAddr , Ipv4Addr , Ipv6Addr } ;
88use crate :: option;
99use crate :: slice;
1010use crate :: sys:: net:: netc as c;
@@ -276,7 +276,7 @@ impl SocketAddrV4 {
276276 SocketAddrV4 {
277277 inner : c:: sockaddr_in {
278278 sin_family : c:: AF_INET as c:: sa_family_t ,
279- sin_port : hton ( port) ,
279+ sin_port : htons ( port) ,
280280 sin_addr : * ip. as_inner ( ) ,
281281 ..unsafe { mem:: zeroed ( ) }
282282 } ,
@@ -326,7 +326,7 @@ impl SocketAddrV4 {
326326 /// ```
327327 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
328328 pub fn port ( & self ) -> u16 {
329- ntoh ( self . inner . sin_port )
329+ ntohs ( self . inner . sin_port )
330330 }
331331
332332 /// Changes the port number associated with this socket address.
@@ -342,7 +342,7 @@ impl SocketAddrV4 {
342342 /// ```
343343 #[ stable( feature = "sockaddr_setters" , since = "1.9.0" ) ]
344344 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) ;
346346 }
347347}
348348
@@ -368,7 +368,7 @@ impl SocketAddrV6 {
368368 SocketAddrV6 {
369369 inner : c:: sockaddr_in6 {
370370 sin6_family : c:: AF_INET6 as c:: sa_family_t ,
371- sin6_port : hton ( port) ,
371+ sin6_port : htons ( port) ,
372372 sin6_addr : * ip. as_inner ( ) ,
373373 sin6_flowinfo : flowinfo,
374374 sin6_scope_id : scope_id,
@@ -420,7 +420,7 @@ impl SocketAddrV6 {
420420 /// ```
421421 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
422422 pub fn port ( & self ) -> u16 {
423- ntoh ( self . inner . sin6_port )
423+ ntohs ( self . inner . sin6_port )
424424 }
425425
426426 /// Changes the port number associated with this socket address.
@@ -436,7 +436,7 @@ impl SocketAddrV6 {
436436 /// ```
437437 #[ stable( feature = "sockaddr_setters" , since = "1.9.0" ) ]
438438 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) ;
440440 }
441441
442442 /// Returns the flow information associated with this address.
0 commit comments