Your code leaves some questions: What is the port incrementor for? Do you really need it? Be aware that a TCP connection needs four symbols to be unique: source address + port => destination port + address. The source port is normally generated by the OS "magic", so you should be able to connect from one source adress to the same destination (port and address) about 64000 times without a need to think about it. Just leave the source port empty.
You are await-ing the connect. Is it a separate thread? You should think about using a listener instead of the await. It scales better. With these changes you might be able to start your connects in a single thread or in a thread pool. That minimises Thread-Overhead and your connections are build much faster. regards Steve > kishore [mailto:[email protected]] wrote: > > Yes i am running an application with a static block as shown below > > static{ > connector = new NioSocketConnector(); > connector.getFilterChain().addLast("codec",new > ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF- > 8")))); > connector.setHandler(new MinaClientHandler_executor("hello > server")); connector.getSessionConfig().setReadBufferSize(1024); > > } > > then i opened the concurrent connections as shown below. > > > for(int i=initialPort;i<(initialPort+numberofports);i++) > { > final int portNumber=i; > > try { > > ConnectFuture future = connector.connect(new > InetSocketAddress(serverIP,serverPort)); > > future.awaitUninterruptibly(); > > if (!future.isConnected()) > { > throw new Exception("port is already in > use"+future.getException()+">>>>>>>>>>>>"); > } > IoSession session = future.getSession(); > }catch(Exception e) { e.printStackTrace(); } > > the MinaClientHandler_executor will send a command to the device and > download the data.But at any instant. But when i run the above program > with 1000 connection,concurrently only 36 files are getting downloaded. > > Do i need to make any changes to the above code. > > > > > > > > -- > View this message in context: http://apache- > mina.10907.n7.nabble.com/NIO-Client-Sockets-tp40029p40031.html > Sent from the Apache MINA Developer Forum mailing list archive at > Nabble.com. >
