YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.hub.InboundServer Class Reference

The listening side of the client-initiated mode (spec, "Client Initiated Connections"): a client that finds this server by mDNS (_sendspin-server._tcp) opens a WebSocket to it and speaks first. More...

Collaboration diagram for de.yaacc.sendspin.hub.InboundServer:
Collaboration graph

Classes

interface  Listener
 Receives a connection whose WebSocket upgrade is done. More...
 

Public Member Functions

 InboundServer (int port, String path, Predicate< InetAddress > accept, Listener listener, int maxConnections, int timeoutMillis)
 
void setLocalPath (String secretPath)
 A second path, with a secret in it, that is served over the loopback address only; a link that came by it is delivered as local.
 
synchronized void start () throws IOException
 Binds the port and starts accepting.
 
int port ()
 The port that is bound (the real one when 0 was asked for), or -1 if the server is not running.
 
boolean isRunning ()
 
synchronized void close ()
 Stops accepting.
 

Detailed Description

The listening side of the client-initiated mode (spec, "Client Initiated Connections"): a client that finds this server by mDNS (_sendspin-server._tcp) opens a WebSocket to it and speaks first.

Opt-in (the user's switch, off by default) and as small as it can be: only addresses the filter accepts are read at all, a request with an Origin header or for another path is refused, a client that does not finish its upgrade within the timeout is dropped, and at most maxConnections are held at once (a closed link makes room). The handshake and everything after it belong to the hub connection. Closing the server stops new connections only; established ones go on. Nothing is read from a connection before it passed the filter.

Constructor & Destructor Documentation

◆ InboundServer()

de.yaacc.sendspin.hub.InboundServer.InboundServer ( int port,
String path,
Predicate< InetAddress > accept,
Listener listener,
int maxConnections,
int timeoutMillis )
Parameters
portthe port to listen on, 0 for any free one
paththe only request path that is served
acceptwhich remote addresses are read at all (the local network)
timeoutMillishow long the upgrade of one client may take
Here is the call graph for this function:

Member Function Documentation

◆ close()

synchronized void de.yaacc.sendspin.hub.InboundServer.close ( )

Stops accepting.

Connections that are established are not touched.

◆ setLocalPath()

void de.yaacc.sendspin.hub.InboundServer.setLocalPath ( String secretPath)

A second path, with a secret in it, that is served over the loopback address only; a link that came by it is delivered as local.

Any program on the phone can reach the loopback address, so the address alone proves nothing: the secret exists only in this process. Null: there is no such path.

◆ start()

synchronized void de.yaacc.sendspin.hub.InboundServer.start ( ) throws IOException

Binds the port and starts accepting.

Exceptions
IOExceptionif the port can not be bound

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