public class RegisterClient
extends java.lang.Object
RegisterClient is used for: clientId (if client does not have any clientId assigned before) clientId of the client (if the client has one)| Modifier and Type | Field and Description |
|---|---|
private java.net.InetAddress |
ip
IP address of the VBS server.
|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private java.net.Socket |
mySocket
The socket used for communication with the VBS server.
|
private int |
port
Number of the TCP port on the VBS server on which it listens for upgrade requests.
|
| Constructor and Description |
|---|
RegisterClient(java.lang.String ip,
int port)
Constructs the class.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
register()
Registers the client at the server.
|
boolean |
validateClientId(java.lang.String clientId)
Validates whether the client identifier is correct.
|
private static org.apache.log4j.Logger log
private java.net.Socket mySocket
private int port
private java.net.InetAddress ip
public RegisterClient(java.lang.String ip,
int port)
throws java.io.IOException
ip - IP address of the VBS serverport - number of the TCP port on the VBS server on which it listens for registration requestsjava.io.IOException - if the IP address of the server is invalidpublic java.lang.String register()
throws java.io.IOException
clientId is received.clientId received from the server. If clientId is null, registration failed.java.io.IOException - if registration fails due to problem with communication between the client and the serverpublic boolean validateClientId(java.lang.String clientId)
throws java.io.IOException
clientId - the client identifier to validatetrue if client identifier can be validated, false otherwisejava.io.IOException - If validation fails due to problem with communication between the client and the server