Methods Summary |
---|
public void | addConnection(java.net.Socket socket)
connectionCounter++;
Connection connection = new Connection(this, connectionCounter, socket);
connections.addElement(connection);
|
public void | addListener(com.sun.media.rtsp.RtspListener listener)
listeners.addElement(listener);
|
public void | closeConnection(int connectionId)
Connection connection = getConnection(connectionId);
if (connection != null) {
connection.close();
connections.removeElement(connection);
} else {
System.out.println("connection not found!");
}
|
public int | createConnection(java.lang.String address, int port)
this.address = address;
this.port = port;
int connectionId = -1;
try {
Connection connection = new Connection(this, connectionCounter + 1,
address.getBytes(), port);
connections.addElement(connection);
connectionId = connection.connectionId;
connectionCounter++;
} catch (UnknownHostException e) {
Log.error("[EXCEPTION]: Unknown host.");
connectionId = -2;
}
catch (ConnectException e) {
Log.error("[EXCEPTION]: Can't connect to server.");
connectionId = -3;
}
return connectionId;
|
public void | dataIndication(int connectionId, Message message)
for (int i = 0; i < listeners.size(); i++) {
RtspListener listener = (RtspListener) listeners.elementAt(i);
listener.rtspMessageIndication(connectionId, message);
}
|
public com.sun.media.rtsp.Connection | getConnection(int connectionId)
Connection connection = null;
for (int i = 0; i < connections.size(); i++) {
Connection tmpConnection = (Connection) connections.elementAt(i);
if (tmpConnection.connectionId == connectionId) {
connection = tmpConnection;
break;
}
}
return connection;
|
public void | removeConnection(int connectionId)
Connection connection = getConnection(connectionId);
connections.removeElement(connection);
for (int i = 0; i < listeners.size(); i++) {
RtspListener listener = (RtspListener) listeners.elementAt(i);
listener.rtspConnectionTerminated(connectionId);
}
|
public void | removeListener(com.sun.media.rtsp.RtspListener listener)
listeners.removeElement(listener);
|
public boolean | sendMessage(int connectionId, java.lang.String message)
Log.comment("outgoing msg:");
Log.comment(message);
Connection connection = getConnection(connectionId);
boolean success;
if (connection == null) {
success = false;
} else {
success = connection.sendData(message.getBytes());
}
return success;
|