QtMobility Reference Documentation

QLlcpServer Class Reference

The QLlcpServer class provides an NFC LLCP socket based server. More...

 #include <QLlcpServer>

Inherits: QObject.

This class was introduced in Qt Mobility 1.2.

Public Functions

QLlcpServer ( QObject * parent = 0 )
virtual ~QLlcpServer ()
void close ()
virtual bool hasPendingConnections () const
bool isListening () const
bool listen ( const QString & serviceUri )
virtual QLlcpSocket * nextPendingConnection ()
QLlcpSocket::SocketError serverError () const
quint8 serverPort () const
QString serviceUri () const
  • 29 public functions inherited from QObject

Signals

void newConnection ()

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QLlcpServer class provides an NFC LLCP socket based server.

This class makes it possible to accept incoming LLCP socket connections.

Call listen() to have the server start listening for incoming connections on a specified port. The newConnection() signal is then emitted each time a client connects to the server.

Call nextPendingConnection() to accept the pending connection as a connected QLlcpSocket. The function returns a pointer to a QLlcpSocket that can be used for communicating with the client.

If an error occurs, serverError() returns the type of error, and errorString() can be called to get a human readable description of what happened.

When listening for connections, the port which the server is listening on is available through serverPort().

Calling close() makes QLlcpServer stop listening for incoming connections.

Member Function Documentation

QLlcpServer::QLlcpServer ( QObject * parent = 0 )

Constructs a new NFC LLCP server with parent.

QLlcpServer::~QLlcpServer () [virtual]

Destroys the NFC LLCP server.

void QLlcpServer::close ()

Stops listening for incoming connections.

bool QLlcpServer::hasPendingConnections () const [virtual]

Returns true if the server has a pending connection; otherwise returns false.

See also nextPendingConnection().

bool QLlcpServer::isListening () const

Returns true if the server is listening for incoming connections; otherwise returns false.

bool QLlcpServer::listen ( const QString & serviceUri )

Tells the server to listen for incoming connections on serviceUri. If the server is currently listening then it will return false. Returns true on success; otherwise returns false.

serviceUri() will return the serviceUri that is passed into listen.

serverPort() will return the port that is assigned to the server.

See also serverPort(), isListening(), and close().

void QLlcpServer::newConnection () [signal]

This signal is emitted every time a new connection is available.

See also hasPendingConnections() and nextPendingConnection().

QLlcpSocket * QLlcpServer::nextPendingConnection () [virtual]

Returns the next pending connection as a connected QLlcpSocket object.

The socket is created as a child of the server, which means that it is automatically deleted when the QLlcpServer object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.

0 is returned if this function is called when there are no pending connections.

See also hasPendingConnections() and newConnection().

QLlcpSocket::SocketError QLlcpServer::serverError () const

Returns the last error that occurred.

quint8 QLlcpServer::serverPort () const

Returns the LLCP port associated with the service URI that the server is listening on.

Note: This call is not supported on all platforms and will return 0 on these platforms.

QString QLlcpServer::serviceUri () const

Returns the LLCP service URI that the server is listening on.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.