|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pkrete.jsip2.connection.SIP2SocketConnection
public class SIP2SocketConnection
This class is responsible of the communication between the system and the ILS SIP server. The communication is based on a socket connection, which means that the data is sent and received by using a socket. The connection between the system and the ILS is stateless, and its based on message/reponse pairs. Each pair should stand on its own, irrespoective of any previous or future pair. However, in practise there are depencies between the message pairs. For example, in most cases the system must first log in to the ILS SIP server before sending any other messages.
| Constructor Summary | |
|---|---|
SIP2SocketConnection(String host,
int port)
Constructs and initializes a new SIP2SocketConnection object with the given host and port. |
|
SIP2SocketConnection(String host,
int port,
int timeout)
Constructs and initializes a new SIP2SocketConnection object with the given host, port and timeout. |
|
| Method Summary | |
|---|---|
boolean |
close()
Closes the connection to the ILS SIP server. |
boolean |
connect()
Connects to the ILS SIP server. |
boolean |
connected()
Returns true if and only if the socket is connected to a server. |
Socket |
getSocket()
Returns the socket used for the connection with the ILS SIP server. |
String |
read()
Read a line of text. |
SIP2MessageResponse |
send(SIP2MessageRequest request)
Sends the given SIP2MessageRequest to the ILS SIP server and returns the SIP2MessageResponse received. |
void |
setSocket(Socket socket)
Sets the used for the connection with the ILS SIP server. |
boolean |
write(String data)
Sends the given string to the ILS SIP server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SIP2SocketConnection(String host,
int port)
host - address of the ILS SIP serverport - port number of the ILS SIP server
public SIP2SocketConnection(String host,
int port,
int timeout)
host - address of the ILS SIP serverport - port number of the ILS SIP servertimeout - timeout value in milliseconds| Method Detail |
|---|
public boolean connect()
public boolean close()
public boolean write(String data)
data - string to be sent
public String read()
public SIP2MessageResponse send(SIP2MessageRequest request)
throws InvalidSIP2ResponseException,
InvalidSIP2ResponseValueException
request - SIP2MessageRequest to be sent
InvalidSIP2ResponseException
InvalidSIP2ResponseValueExceptionpublic boolean connected()
public Socket getSocket()
public void setSocket(Socket socket)
socket - new socket
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||