net.h File Reference

Common network I/O and utility functions. More...

#include <QHostAddress>

Go to the source code of this file.

Functions

QHostAddress net_local_address ()
bool net_is_private_address (QHostAddress addr)
bool net_is_valid_ip (QString ip)
bool net_get_public_ip (QString &ip)
bool net_test_connect (QHostAddress host, quint16 port, int timeout=250)


Detailed Description

Common network I/O and utility functions.

Version:
Id

Definition in file net.h.


Function Documentation

bool net_get_public_ip ( QString &  ip  ) 

Tries to determine this machine's external IP.

Asks a pre-defined list of servers what they think this machine's public IP address is.

Parameters:
ip Stores the ip after a successful request
Returns:
false if none of the requests were successful

Definition at line 97 of file net.cpp.

References get_check_ip_sites(), and net_is_valid_ip().

bool net_is_private_address ( QHostAddress  addr  ) 

Returns true if the given address is a private IP.

Returns true if the given address is a private IP address.

Definition at line 55 of file net.cpp.

bool net_is_valid_ip ( QString  ip  ) 

Returns true if the given IP address is a valid IPv4 address.

Returns true if the given string representation of an IP address is valid.

Definition at line 70 of file net.cpp.

QHostAddress net_local_address (  ) 

Returns the local machine's IP address.

Returns the IP address of the local machine.

Definition at line 39 of file net.cpp.

bool net_test_connect ( QHostAddress  host,
quint16  port,
int  timeout 
)

Attempts a connection to host on port. Returns true if the connection was successful, or false if the connection attempt failed.

Definition at line 115 of file net.cpp.


Generated on Wed Sep 5 15:49:28 2007 for Vidalia by  doxygen 1.5.3