# Struct std::net::SocketAddrV4 [−] [src]

    pub struct SocketAddrV4 {
        // some fields omitted
    }

An IPv4 socket address which is a (ip, port) combination.

## Methods

### `impl SocketAddrV4`

#### `fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4`

Creates a new socket address from the (ip, port) pair.

#### `fn ip(&self) -> &Ipv4Addr`

Returns the IP address associated with this socket address.

#### `fn port(&self) -> u16`

Returns the port number associated with this socket address.

## Trait Implementations

### `impl Display for SocketAddrV4`

#### `fn fmt(&self, f: &mut Formatter) -> Result`

### `impl Debug for SocketAddrV4`

#### `fn fmt(&self, fmt: &mut Formatter) -> Result`

### `impl Clone for SocketAddrV4`

#### `fn clone(&self) -> SocketAddrV4`

#### `fn clone_from(&mut self, source: &Self)`

### `impl PartialEq for SocketAddrV4`

#### `fn eq(&self, other: &SocketAddrV4) -> bool`

#### `fn ne(&self, other: &Rhs) -> bool`

### `impl Eq for SocketAddrV4`

### `impl Hash for SocketAddrV4`

#### `fn hash<H: Hasher>(&self, s: &mut H)`

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher`

### `impl ToSocketAddrs for SocketAddrV4`

#### `type Iter = IntoIter<SocketAddr>`

#### `fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>`

### `impl FromStr for SocketAddrV4`

#### `type Err = AddrParseError`

#### `fn from_str(s: &str) -> Result<SocketAddrV4, AddrParseError>`

### Derived Implementations

### `impl Copy for SocketAddrV4`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize`)