libktorrent  2.2.0
Classes | Public Types | Public Member Functions | List of all members
net::ServerSocket Class Reference

#include <serversocket.h>

Inheritance diagram for net::ServerSocket:
Inheritance graph
[legend]

Classes

class  ConnectionHandler
 
class  DataHandler
 

Public Types

typedef QSharedPointer< ServerSocketPtr
 

Public Member Functions

 ServerSocket (ConnectionHandler *chandler)
 
 ServerSocket (DataHandler *dhandler)
 
bool bind (const net::Address &addr)
 
bool bind (const QString &ip, bt::Uint16 port)
 
int sendTo (const bt::Uint8 *buf, int size, const net::Address &addr)
 
int sendTo (const QByteArray &data, const net::Address &addr)
 
void setReadNotificationsEnabled (bool on)
 
bool setTOS (unsigned char type_of_service)
 
void setWriteNotificationsEnabled (bool on)
 

Detailed Description

Convenience class to create and bind a server socket. Internally it combines a QSocketNotifier and a net::Socket.

Definition at line 41 of file serversocket.h.

Constructor & Destructor Documentation

◆ ServerSocket() [1/2]

net::ServerSocket::ServerSocket ( ConnectionHandler chandler)

Create a TCP server socket

Parameters
chandlerThe connection handler

◆ ServerSocket() [2/2]

net::ServerSocket::ServerSocket ( DataHandler dhandler)

Create an UDP server socket

Parameters
dhandlerThe data handler

Member Function Documentation

◆ bind() [1/2]

bool net::ServerSocket::bind ( const net::Address addr)

Bind the socket to an address

Parameters
addrThe address
Returns
true upon success, false otherwise

◆ bind() [2/2]

bool net::ServerSocket::bind ( const QString &  ip,
bt::Uint16  port 
)

Bind the socket to an IP and port

Parameters
ipThe IP address
portThe port number
Returns
true upon success, false otherwise

◆ sendTo() [1/2]

int net::ServerSocket::sendTo ( const bt::Uint8 *  buf,
int  size,
const net::Address addr 
)

Method to send data with the socket. Only use this when the socket is a UDP socket. It will fail for TCP server sockets.

Parameters
bufThe data to send
sizeThe size of the data
addrThe address to send to
Returns
The number of bytes sent

◆ sendTo() [2/2]

int net::ServerSocket::sendTo ( const QByteArray &  data,
const net::Address addr 
)

Method to send data with the socket. Only use this when the socket is a UDP socket. It will fail for TCP server sockets.

Parameters
dataThe data to send
addrThe address to send to
Returns
The number of bytes sent

◆ setReadNotificationsEnabled()

void net::ServerSocket::setReadNotificationsEnabled ( bool  on)

Enable read notifications.

Parameters
onOn or not

◆ setTOS()

bool net::ServerSocket::setTOS ( unsigned char  type_of_service)

Set the TOS byte of the socket

Parameters
type_of_serviceValue to set
Returns
true upon success, false otherwise

◆ setWriteNotificationsEnabled()

void net::ServerSocket::setWriteNotificationsEnabled ( bool  on)

Enable write notifications.

Parameters
onOn or not

The documentation for this class was generated from the following file: