IPAddress.h File Reference

#include <SFML/Config.h>

Go to the source code of this file.


Data Structures

struct  sfIPAddress
 sfIPAddress provides easy manipulation of IP v4 addresses More...

Functions

CSFML_API sfIPAddress sfIPAddress_FromString (const char *String)
 Construct an address from a string.
CSFML_API sfIPAddress sfIPAddress_FromBytes (sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3)
 Construct an address from 4 bytes.
CSFML_API sfIPAddress sfIPAddress_FromInteger (sfUint32 Address)
 Construct the address from a 32-bits integer.
CSFML_API sfBool sfIPAddress_IsValid (sfIPAddress Address)
 Tell if an address is a valid one.
CSFML_API void sfIPAddress_ToString (sfIPAddress Address, char *String)
 Get a string representation of an address.
CSFML_API sfUint32 sfIPAddress_ToInteger (sfIPAddress Address)
 Get an integer representation of the address.
CSFML_API sfIPAddress sfIPAddress_GetLocalAddress ()
 Get the computer's local IP address (from the LAN point of view).
CSFML_API sfIPAddress sfIPAddress_GetPublicAddress (float Timeout)
 Get the computer's public IP address (from the web point of view).
CSFML_API sfIPAddress sfIPAddress_LocalHost ()
 Get the computer's loopback address.

Function Documentation

CSFML_API sfIPAddress sfIPAddress_FromBytes ( sfUint8  Byte0,
sfUint8  Byte1,
sfUint8  Byte2,
sfUint8  Byte3 
)

Construct an address from 4 bytes.

Parameters:
Byte0 : First byte of the address
Byte1 : Second byte of the address
Byte2 : Third byte of the address
Byte3 : Fourth byte of the address
Returns:
Resulting address

CSFML_API sfIPAddress sfIPAddress_FromInteger ( sfUint32  Address  ) 

Construct the address from a 32-bits integer.

Parameters:
Address : 4 bytes of the address packed into a 32-bits integer

CSFML_API sfIPAddress sfIPAddress_FromString ( const char *  String  ) 

Construct an address from a string.

Parameters:
String : IP address ("xxx.xxx.xxx.xxx") or network name
Returns:
Resulting address

CSFML_API sfIPAddress sfIPAddress_GetLocalAddress (  ) 

Get the computer's local IP address (from the LAN point of view).

Returns:
Local IP address

CSFML_API sfIPAddress sfIPAddress_GetPublicAddress ( float  Timeout  ) 

Get the computer's public IP address (from the web point of view).

The only way to get a public address is to ask it to a distant website ; as a consequence, this function may be very slow -- use it as few as possible !

Parameters:
Timeout : Maximum time to wait, in seconds (use 0 for no timeout)
Returns:
Public IP address

CSFML_API sfBool sfIPAddress_IsValid ( sfIPAddress  Address  ) 

Tell if an address is a valid one.

Parameters:
Address : Address to check
Returns:
sfTrue if address has a valid syntax

CSFML_API sfIPAddress sfIPAddress_LocalHost (  ) 

Get the computer's loopback address.

Returns:
Local host IP address (127.0.0.1, or "localhost")

CSFML_API sfUint32 sfIPAddress_ToInteger ( sfIPAddress  Address  ) 

Get an integer representation of the address.

Parameters:
Address : Address to convert
Returns:
32-bits integer containing the 4 bytes of the address, in system endianness

CSFML_API void sfIPAddress_ToString ( sfIPAddress  Address,
char *  String 
)

Get a string representation of an address.

Parameters:
Address : Address to convert
String : Char array to fill (size must be >= 16)