I want to send data periodically from client to server. How can I do that
in Mina while the data well send via client handler.
I write openSocket() function like this:
public void openSocket(Object c)
{
connector.getSessionConfig().
setReadBufferSize(2048);
connector.getFilterChain().addLast("logger", new LoggingFilter());
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new
myCodecFactory()));
connector.setHandler(new
net.floodlightcontroller.Example.ClientSessionHandler(c));
ConnectFuture future = connector.connect(new
InetSocketAddress(HOSTNAME, PORT));
future.awaitUninterruptibly();
IoSession session = future.getSession();
session.getConfig().setUseReadOperation(true);
session.getCloseFuture().awaitUninterruptibly();
connector.dispose();
}
as you see the function receive an object which contain my initial data
after I call it in init() function. if I want to send another data after a
period of second by the same connection, How can I do that. if I call
openSocket() function like below code it does not work. where can I call it
and How?
try {
while (true){
openSocket(cObj);
Thread.sleep(5000, 5);}
} catch(InterruptedException ie) {}