|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.java4less.sms.adapters.TcpIpAdapter
This class is used to access the SMSC using a TCIP/IP (internet) connection.
// create object TcpIpAdapter tcp=new TcpIpAdapter(); tcp.connect(ServerAddress,port); // send the sms now using the tcp/ip adapter SmsSender sender=new SmsSender(tcp); sender.createSMS51("123","456","Hello"); sender.sendMessage(); tcp.disconnect();
Constructor Summary | |
TcpIpAdapter()
constructor |
|
TcpIpAdapter(java.net.Socket s)
create the tcp adapter using an existing object, this is used by the acceptConnection method only |
Method Summary | |
TcpIpAdapter |
acceptConnection()
wait for conections. |
void |
connect(java.lang.String server,
int port)
establish connection to SMSC server |
void |
createServer(int port)
create a socket server (if this adapter will receive incomming conenctions) |
void |
disconnect()
end connection |
byte[] |
receiveData(java.lang.String endDelimiter,
int ptout)
receive bytes until the delimiter is received, it wait a maximum of tout milliseconds |
void |
stopServer(int port)
create a socket server |
boolean |
transmitBytes(byte[] b,
int len)
transmit bytes. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TcpIpAdapter()
public TcpIpAdapter(java.net.Socket s) throws java.lang.Exception
Method Detail |
public void connect(java.lang.String server, int port) throws java.lang.Exception
java.lang.Exception
public void createServer(int port) throws java.lang.Exception
java.lang.Exception
public void stopServer(int port) throws java.lang.Exception
java.lang.Exception
public TcpIpAdapter acceptConnection() throws java.lang.Exception
TcpIpAdapter tcp=new TcpIpAdapter(); // Create socket tcp.createServer(portNumber); // wait for a connectiond TcpIpAdapter newConnection=tcp.acceptConnection(); // got connection
java.lang.Exception
public void disconnect() throws java.lang.Exception
java.lang.Exception
public boolean transmitBytes(byte[] b, int len)
transmitBytes
in interface Adapter
public byte[] receiveData(java.lang.String endDelimiter, int ptout)
receiveData
in interface Adapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |