Server Sockets and Amazon EC2 -
i have problem ec2 instance (medium), relatively powerful compared laptop, made applet on server side accepts socket connections.
the client connect elastic load balancer, forwarded of servers.
i've tried server side applet on laptop client applet, , works perfectly.
however, when moved server side applet amazon ec2 instance, 100% cpu usage on applet.
this how accept sockets
void listen(int port) throws ioexception { newsocket = new serversocket(port); while (true) { socket sock = newsocket.accept(); printstream out = new printstream(sock.getoutputstream()); outputstreamwithname newitem = new outputstreamwithname(out, null); outputstreams.put(sock, newitem); new serverthread(this, sock, gui); } }
i suspect code might causing 100% cpu load, on laptop both applets uses 10% @ most.
i tried debug code, , stops @ newsocket.accept(), should blocking, should not use lot of cpu?
Comments
Post a Comment