Class OcsfmlNetwork.ip_address

class ip_address : [ `Bytes of int * int * int * int
| `Copy of < rep__sf_IpAddress : IPAddressBase.t; .. >
| `Int of int
| `None
| `String of string ] ->
object .. end
Encapsulate an IPv4 network address.

OcsfmlNetwork.ip_address is a utility class for manipulating network addresses.

It provides a set a implicit constructors and conversion functions to easily build or transform an IP address from/to various representations.

Usage example:

    (* an invalid address *)
    let a0 = new ip_address `None in                      

    (* an invalid address (same as a0) *)
    let a1 = IPAddress.None in                           

    (* the local host address *)
    let a2 = new ip_address (`String ""in      

    (* a local address *)
    let a4 = new ip_address (`Bytes (192, 168, 1, 56)) in 

    (* a local address created from a network name *)
    let a5 = new ip_address (`String "my_computer"in    

    (* a distant address *)
    let a6 = new ip_address (`String ""in    

    (* a distant address created from a network name *)
    let a7 = new ip_address (`String ""in 

    (* my address on the local network *)
    let a8 = IPAddress.get_local_address () in           

    (* my address on the internet *)
    let a9 = IPAddress.get_public_address () in          

method destroy : unit
method affect : < affect : 'a; destroy : unit;
rep__sf_IpAddress : IPAddressBase.t; to_integer : int;
to_string : string; .. > ->
unit as 'a
method to_integer : int
Get an integer representation of the address.

The returned number is the internal representation of the address, and should be used for optimization purposes only (like sending the address through a socket). The integer produced by this function can then be converted back to a ip_address with the proper constructor.

method to_string : string
Get a string representation of the address.

The returned string is the decimal representation of the IP address (like ""), even if it was constructed from a host name.
Returns String representation of the address