xsocket-develop Mailing List for xsocket (Page 9)
Status: Inactive
Brought to you by:
grro
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
(9) |
Nov
(11) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(8) |
Feb
(9) |
Mar
(9) |
Apr
(22) |
May
(28) |
Jun
(17) |
Jul
(10) |
Aug
(19) |
Sep
(4) |
Oct
(14) |
Nov
(26) |
Dec
(25) |
| 2009 |
Jan
(13) |
Feb
(17) |
Mar
(12) |
Apr
(4) |
May
(16) |
Jun
(6) |
Jul
(10) |
Aug
(24) |
Sep
(6) |
Oct
(5) |
Nov
(13) |
Dec
(10) |
| 2010 |
Jan
(17) |
Feb
(21) |
Mar
(10) |
Apr
(8) |
May
(2) |
Jun
(14) |
Jul
(7) |
Aug
(10) |
Sep
(7) |
Oct
(3) |
Nov
|
Dec
(2) |
| 2011 |
Jan
(1) |
Feb
(5) |
Mar
(1) |
Apr
|
May
(5) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(3) |
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|
From: Gregor R. <gre...@gm...> - 2009-05-26 11:30:10
|
|
From: Thomas S. <ts...@ib...> - 2009-05-26 08:25:23
|
Hello,
I'm using xSocket 1.2.1 and I'm really happy how easy it is to use the
Non-Blocking stuff, although I run into the following implementation
problem.
Basically, I have the following onData handler (sorry for the formatting):
public boolean onData(INonBlockingConnection con) throws IOException,
BufferUnderflowException {
EODProtocolContentHandler ch = (EODProtocolContentHandler)
con.getAttachment();
if (ch != null) {
return ch.onData(con);
}
con.resetToReadMark();
con.markReadPosition();
String macAddress =
con.readStringByDelimiter(MCIProtocolConsts.NEWLINE);
String checksum =
con.readStringByDelimiter(MCIProtocolConsts.NEWLINE);
String payLoadLength =
con.readStringByDelimiter(MCIProtocolConsts.NEWLINE);
con.removeReadMark();
// At this point, the header has been read!
// Proceed with reading the payload
ch = new EODProtocolContentHandler(
con.getRemoteAddress().getHostName()
, macAddress
, checksum
, Integer.valueOf(payLoadLength).intValue());
con.setAttachment(ch);
ch.onData(con);
// Proceed with handling the parameter upload
// missing code here ...
return true;
}
This code works fine. It reads a few lines from the socket and then some
kind of payload (compressed XML stream) via a particular content handler.
From the comment "// Proceed with handling the parameter upload on", I
would like to do the following:
1) Writing something back to the client
2) Reading a return code sent by the client
ad 1): works fine by using the con.write method. I'm able to transfer a
few lines and another compressed XML stream to the client.
ad 2): reading the return code although does not work. I'm always
running into the a BufferUnderflowException exception when doing the
following:
con.readStringByDelimiter(MCIProtocolConsts.NEWLINE)
Using the con.markReadPosition ... concepts at this position for reading
the return code from the client doesn't work either, because with the
con.resetToReadMark() at the BEGINNING of the onData handler, it thinks
there should be three lines ...
Any hints are much appreciated!
Thanks,
Thomas
|
|
From: Gregor R. <gre...@gm...> - 2009-05-23 14:04:47
|
|
From: Gregor R. <gre...@gm...> - 2009-05-23 11:23:24
|
|
From: Anri D. <anr...@gm...> - 2009-05-22 05:42:39
|
Hi, I wrote a simple test starting a server and connecting 10 NonBlockingConnection clients. Each client connects and sends a string to the server, and then waits for an echo before it disconnects. The server's onData() handler method does some "heavy" processing, and then sleeps randomly for 1-1000 ms, before sending the echo to the client. This is done to simulate server-side processing, which takes does take time when disk I/O (db calls etc) is taken into the picture. The test kept failing for no apparent reason with some of the 10 clients never receiving their echo. Running the exact same test using Apache Mina produced a 'Out of Memory' Exception. Increasing the JVM memory to a max of 256 mb (using the java args -Xms40m -Xmx256m) immediately solved the issue, for both Mina AND xSocket. The strange thing is that xSocket didn't throw any exceptions, or simply swallowed them up without logging anything (default logging settings). Perhaps this should be made more obvious in the tutorial ? I've included my test in this email (uses JUnit 4.5 and SLF4J) Cheers, - Anri |
|
From: Gregor R. <gre...@gm...> - 2009-05-21 14:37:40
|
|
From: Anri D. <anr...@gm...> - 2009-05-20 11:19:15
|
Hi,
First off, I love xSocket so far. But I've run into a problem when
writing tests for my game server.
I've created a simple test using an echo server and 10
NonBlockingConnection clients.
All works well when the server's onData handler method returns fairly quickly.
But if I put something CPU intensive inside the onData method, to
simulate some sort of processing on the server (CPU bound, no I/O
atm), some of the clients never receive the server echo.
I'm using default settings (server handler is multi-threaded, and
flush mode sync) and I suspect Chapter 11 in the tutorial warns about
this, but I don't quite get it.
Could you please explain what I do wrong ? Thanks a bunch.
Source as follows:
import java.io.IOException;
import java.nio.BufferUnderflowException;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.ConcurrentHashMap;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xsocket.MaxReadSizeExceededException;
import org.xsocket.connection.IConnectHandler;
import org.xsocket.connection.IDataHandler;
import org.xsocket.connection.IDisconnectHandler;
import org.xsocket.connection.IHandler;
import org.xsocket.connection.INonBlockingConnection;
import org.xsocket.connection.IServer;
import org.xsocket.connection.NonBlockingConnection;
import org.xsocket.connection.Server;
public class TestXSocket
{
public static Logger log
= LoggerFactory.getLogger(TestXSocket.class);
public static final String PROTOCOL_DELIMITER = "\0";
@Test
public void testClientServerCom()
{
IServer serv = null;
try
{
log.info("Starting test server..");
serv = new Server("127.0.0.1", 10101, new
ServerHandler());
serv.start();
}
catch (Exception e)
{
e.printStackTrace();
}
ConcurrentHashMap<String, INonBlockingConnection> clients = new
ConcurrentHashMap<String, INonBlockingConnection>();
for (int i = 1; i <= 10; i++)
{
try
{
INonBlockingConnection con = new
NonBlockingConnection(serv.getLocalAddress(),
10101, new
ClientHandler(i), true, 1000);
con.write("Hey Dude #" + i +
TestXSocket.PROTOCOL_DELIMITER);
clients.put(con.getId(), con);
}
catch (IOException e)
{
e.printStackTrace();
break;
}
}
while (clients.size() > 0)
{
for (String conId : clients.keySet())
{
INonBlockingConnection con = clients.get(conId);
ClientHandler handler = (ClientHandler)
con.getHandler();
if (handler.hasGotEcho())
{
log.info("Removing client {}",
handler.getClientId());
clients.remove(conId);
}
else
{
log.info("Client {} still
waiting for echo..", handler.getClientId());
}
}
try
{
Thread.sleep(2000);
}
catch (Exception e)
{
log.info("Wait interrupted!");
break;
}
}
try
{
serv.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private class ServerHandler implements IHandler,
IConnectHandler, IDataHandler,
IDisconnectHandler
{
@Override
public boolean onConnect(INonBlockingConnection arg0)
throws IOException,
BufferUnderflowException,
MaxReadSizeExceededException
{
log.info("Server Connected {}", arg0.getId());
arg0.write("Welcome " + arg0.getId() +
TestXSocket.PROTOCOL_DELIMITER);
return true;
}
@Override
public boolean onData(INonBlockingConnection arg0)
throws IOException,
BufferUnderflowException, ClosedChannelException,
MaxReadSizeExceededException
{
String read =
arg0.readStringByDelimiter(TestXSocket.PROTOCOL_DELIMITER);
log.info("Server Data Received {} : {}",
arg0.getId(), read);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 1000000; i++)
{
sb.append(i);
}
sb.setLength(0);
arg0.write("Echo " + read +
TestXSocket.PROTOCOL_DELIMITER);
log.info("Server Sent Echo : {}", read);
return true;
}
@Override
public boolean onDisconnect(INonBlockingConnection
arg0) throws IOException
{
log.info("Server Disconnected {}", arg0.getId());
arg0.write("Bye " + arg0.getId() +
TestXSocket.PROTOCOL_DELIMITER);
return true;
}
}
private class ClientHandler implements IConnectHandler, IDataHandler,
IDisconnectHandler
{
private int clientId = 0;
private boolean gotEcho = false;
public ClientHandler(int clientId)
{
this.clientId = clientId;
}
public int getClientId()
{
return clientId;
}
public boolean hasGotEcho()
{
return gotEcho;
}
public void setGotEcho(boolean gotEcho)
{
this.gotEcho = gotEcho;
}
@Override
public boolean onConnect(INonBlockingConnection arg0)
throws IOException,
BufferUnderflowException,
MaxReadSizeExceededException
{
log.info("Client Connected {}", clientId);
return false;
}
@Override
public boolean onData(INonBlockingConnection arg0)
throws IOException,
BufferUnderflowException, ClosedChannelException,
MaxReadSizeExceededException
{
String read =
arg0.readStringByDelimiter(TestXSocket.PROTOCOL_DELIMITER);
log.info("Client Data Received {} : {}", clientId, read);
if (read.contains("Echo "))
{
setGotEcho(true);
}
return false;
}
@Override
public boolean onDisconnect(INonBlockingConnection
arg0) throws IOException
{
log.info("Client Disconnected {}", clientId);
return false;
}
}
}
--
Mvh/Anri
|
|
From: Anri D. <anr...@gm...> - 2009-05-20 11:13:20
|
Hi,
First off, I love xSocket so far. But I've run into a problem when
writing tests for my game server.
I've created a simple test using an echo server and 10
NonBlockingConnection clients.
All works well when the server's onData handler method returns fairly quickly.
But if I put something CPU intensive inside the onData method, to
simulate some sort of processing on the server (CPU bound, no I/O
atm), some of the clients never receive the server echo.
I'm using default settings (server handler is multi-threaded, and
flush mode sync) and I suspect Chapter 11 in the tutorial warns about
this, but I don't quite get it.
Could you please explain what I do wrong ? Thanks a bunch.
Source as follows:
import java.io.IOException;
import java.nio.BufferUnderflowException;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.ConcurrentHashMap;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xsocket.MaxReadSizeExceededException;
import org.xsocket.connection.IConnectHandler;
import org.xsocket.connection.IDataHandler;
import org.xsocket.connection.IDisconnectHandler;
import org.xsocket.connection.IHandler;
import org.xsocket.connection.INonBlockingConnection;
import org.xsocket.connection.IServer;
import org.xsocket.connection.NonBlockingConnection;
import org.xsocket.connection.Server;
public class TestXSocket
{
public static Logger log = LoggerFactory.getLogger(TestXSocket.class);
public static final String PROTOCOL_DELIMITER = "\0";
@Test
public void testClientServerCom()
{
IServer serv = null;
try
{
log.info("Starting test server..");
serv = new Server("127.0.0.1", 10101, new ServerHandler());
serv.start();
}
catch (Exception e)
{
e.printStackTrace();
}
ConcurrentHashMap<String, INonBlockingConnection> clients = new
ConcurrentHashMap<String, INonBlockingConnection>();
for (int i = 1; i <= 10; i++)
{
try
{
INonBlockingConnection con = new
NonBlockingConnection(serv.getLocalAddress(),
10101, new ClientHandler(i), true, 1000);
con.write("Hey Dude #" + i + TestXSocket.PROTOCOL_DELIMITER);
clients.put(con.getId(), con);
}
catch (IOException e)
{
e.printStackTrace();
break;
}
}
while (clients.size() > 0)
{
for (String conId : clients.keySet())
{
INonBlockingConnection con = clients.get(conId);
ClientHandler handler = (ClientHandler) con.getHandler();
if (handler.hasGotEcho())
{
log.info("Removing client {}", handler.getClientId());
clients.remove(conId);
}
else
{
log.info("Client {} still waiting for echo..", handler.getClientId());
}
}
try
{
Thread.sleep(2000);
}
catch (Exception e)
{
log.info("Wait interrupted!");
break;
}
}
try
{
serv.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private class ServerHandler implements IHandler, IConnectHandler, IDataHandler,
IDisconnectHandler
{
@Override
public boolean onConnect(INonBlockingConnection arg0) throws IOException,
BufferUnderflowException, MaxReadSizeExceededException
{
log.info("Server Connected {}", arg0.getId());
arg0.write("Welcome " + arg0.getId() + TestXSocket.PROTOCOL_DELIMITER);
return true;
}
@Override
public boolean onData(INonBlockingConnection arg0) throws IOException,
BufferUnderflowException, ClosedChannelException,
MaxReadSizeExceededException
{
String read = arg0.readStringByDelimiter(TestXSocket.PROTOCOL_DELIMITER);
log.info("Server Data Received {} : {}", arg0.getId(), read);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 1000000; i++)
{
sb.append(i);
}
sb.setLength(0);
arg0.write("Echo " + read + TestXSocket.PROTOCOL_DELIMITER);
log.info("Server Sent Echo : {}", read);
return true;
}
@Override
public boolean onDisconnect(INonBlockingConnection arg0) throws IOException
{
log.info("Server Disconnected {}", arg0.getId());
arg0.write("Bye " + arg0.getId() + TestXSocket.PROTOCOL_DELIMITER);
return true;
}
}
private class ClientHandler implements IConnectHandler, IDataHandler,
IDisconnectHandler
{
private int clientId = 0;
private boolean gotEcho = false;
public ClientHandler(int clientId)
{
this.clientId = clientId;
}
public int getClientId()
{
return clientId;
}
public boolean hasGotEcho()
{
return gotEcho;
}
public void setGotEcho(boolean gotEcho)
{
this.gotEcho = gotEcho;
}
@Override
public boolean onConnect(INonBlockingConnection arg0) throws IOException,
BufferUnderflowException, MaxReadSizeExceededException
{
log.info("Client Connected {}", clientId);
return false;
}
@Override
public boolean onData(INonBlockingConnection arg0) throws IOException,
BufferUnderflowException, ClosedChannelException,
MaxReadSizeExceededException
{
String read = arg0.readStringByDelimiter(TestXSocket.PROTOCOL_DELIMITER);
log.info("Client Data Received {} : {}", clientId, read);
if (read.contains("Echo "))
{
setGotEcho(true);
}
return false;
}
@Override
public boolean onDisconnect(INonBlockingConnection arg0) throws IOException
{
log.info("Client Disconnected {}", clientId);
return false;
}
}
}
|
|
From: Gregor R. <gre...@gm...> - 2009-05-17 05:35:27
|
------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects |
|
From: Ciccio A. <alt...@gm...> - 2009-05-15 17:46:41
|
Hello! Many thanks for your reply. I still got the error (listening 0.0.0.0) even if i made the adjustment you said (leave only srv.run(); ). So... i'm really stuck! |
|
From: Gregor R. <gre...@gm...> - 2009-05-14 04:13:00
|
------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com |
|
From: Udomsak D. <UDo...@vi...> - 2009-05-13 12:36:21
|
I'm a beginner and really interesting with xsocket
So, Can you give me more detail about "xSocket multiplexed" and "xLightweb" (on side of programming )
For xSocket multiplexed( better if you give me Eclipse "hello world "project by xsocket )
- Server
1. Is stand alone? (If not how to configure server and which server
2. if stand alone how can I implement server (in detail of each class)
- Client
1. in "tutorial - multiplexed streaming support<http://xsocket.sourceforge.net/multiplexed/tutorial/V2/TutorialMultiplexed.htm>" can I use client code in main class
For xLightweb
Can you create some project ?just simple project and send source code
Thank you very much for information
|
|
From: Ciccio A. <alt...@gm...> - 2009-05-13 10:58:21
|
Hello!
Nice to write here.
I have a simple question to ask you.
First times i started xSocket on the 8090 port i got this message:
13-mag-2009 12.54.47 org.xsocket.connection.Server$LifeCycleHandler
onConnected
INFO: server listening on 127.0.0.1:8090 (xSocket 2.4.6)
and everything worked fine.
Now... when i run my app i get this message:
13-mag-2009 12.54.47 org.xsocket.connection.Server$LifeCycleHandler
onConnected
INFO: server listening on 0.0.0.0:8090 (xSocket 2.4.6)
and, obviously, nothin' works anymore.
What can it be??
this is my code:
import org.xsocket.connection.*;
public class Connessione
{
protected static IServer srv = null;
public static void main(String[] args)
{
try
{
srv = new Server(8090, new xSocketDataHandler());
srv.run();
srv.start();
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}
}
protected static void shutdownServer()
{
try
{
srv.close();
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}
}
}
And this is my other class.
import java.io.IOException;
import java.nio.BufferUnderflowException;
import java.nio.channels.ClosedChannelException;
import org.xsocket.*;
import org.xsocket.connection.*;
public class xSocketDataHandler implements IDataHandler
{
public boolean onData(INonBlockingConnection nbc) throws IOException,
BufferUnderflowException, ClosedChannelException,
MaxReadSizeExceededException
{
try
{
String data = nbc.readStringByDelimiter("\0");
nbc.write(data + "\0");
if(data.equalsIgnoreCase("SHUTDOWN"))
Connessione.shutdownServer();
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}
return true;
}
}
It's like how it is done in the tutorial.
Any idea?
Many thanks!
Cheers from Italy.
|
|
From: Gregor R. <gre...@gm...> - 2009-05-09 07:24:51
|
------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com |
|
From: Wu H. <har...@gm...> - 2009-05-05 03:19:46
|
Now I am using XSocket to work for some asynchronous use case. Eg. update
click number of forum article.
But I found that something wrong happened.
I traced the code. Found that if NonBlockingConnection fetched from
NonBlockingConnectionPool and set flushmode to FlushMode.ASYNC,
only partial request can be normally received by server.
I also found some other situation:
1)If NonBlockingConnection fetched by created every time, everything works
well;
2)If NonBlockingConnection fetched from pool, and flushmode set to
FlushMode.ASYNC,
but thread sleep few ms, everything works well;
3)If NonBlockingConnection fetched from pool, and flushmode set to
FlushMode.SYNC,
without thread sleep, everything works well;
It is a bug of XSocket? I am not sure. Can anybody give me some help?
My XSocket Client:
--------------------------------------------------------------------------
public static void testNonBlocking(int index){
INonBlockingConnection connection=null;
try{
//get nonblocking connection
//connection= new NonBlockingConnection("192.169.100.8", 10001);
connection = pool.getNonBlockingConnection("192.169.100.8",
10001);
connection.setAutoflush(false);
connection.setFlushmode(FlushMode.ASYNC);
connection.write(index + " select sql");
connection.write(DELIMITER);
connection.flush();
connection.close();
//sleep 10ms, without sleep, data lost when connection fetched
from pool
//Thread.sleep(10);
}catch(Exception e){
if(connection != null){
try {
pool.destroy(connection);
} catch (IOException e1) {
}
}
e.printStackTrace();
}
}
--------------------------------------------------------------------------------
My XSocket server DataHandler:
--------------------------------------------------------------------------------
public boolean onData(INonBlockingConnection nbc)
throws IOException, BufferUnderflowException,
ClosedChannelException, MaxReadSizeExceededException {
System.out.println("onData");
String data = nbc.readStringByDelimiter(DELIMITER);
System.out.println(data);
String remoteIP = nbc.getRemoteAddress().getHostAddress();
String localIP = nbc.getLocalAddress().getHostAddress();
String remoteHostname = nbc.getRemoteAddress().getHostName();
String localHostname = nbc.getLocalAddress().getHostName();
nbc.write(data + DELIMITER);
return true;
}
public boolean onConnect(INonBlockingConnection connection)
throws IOException, BufferUnderflowException,
MaxReadSizeExceededException {
connection.setAutoflush(false);
connection.setFlushmode(FlushMode.ASYNC);
System.out.println("onConnect");
return false;
}
-------------------------------------------------------------------------------
--
Harry Wu
Cell: +86(0) 13632390992
|
|
From: Gregor R. <gre...@gm...> - 2009-04-18 14:36:17
|
------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com |
|
From: Gregor R. <gre...@gm...> - 2009-04-17 14:49:07
|
------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p |
|
From: java f. <lan...@gm...> - 2009-04-15 01:51:54
|
Hi,
class B implements IDataHandler {
public boolean onDisconnect(INonBlockingConnection nbc) throws
IOException {
//....Some operation
return true;
}
}
class A implements IDataHandler {
public boolean onDisconnect(INonBlockingConnection nbc) throws
IOException {
//...
connection.setHandler(new B());
return true;
}
}
At first ,
IServer srv = new Server(9999, new A());
at IDataHandler A ,it let IDataHandler B to continue to process .
I want to know when connection closed , does it influence the new
incoming connection? which IDataHandler will be used to handle the new
connection? A or B?
Thanks in advance.
Best Regards
lance
|
|
From: Cameron M. <fo...@re...> - 2009-04-10 22:16:12
|
Good evening all,
I am using the newest xSocket 2.4.6 and attempting to create a chat server
that can handle many clients simultaneously. This will be running on a
dedicated linux server with an AMD 1300 cpu and 512mb of ram. I have
created a test server and client from hacking together various tutorials. I
seem to be having some possible performance problems and would like to get
anyones input on my code and where I have not gone the most optimized route.
Server:
Main.java
In mail the only thing to note is I use
"srv.setWorkerpool(Executors.newFixedThreadPool(10));"
to try to limit the thread pool to 10 open threads instead of the default
40. What do you recommend? I tried using the default in my tests (see
below) and with only 40 simultaneous connections I start to get failures and
dropped connections.
xSocketDataHandler.java, Implements onData, onConnect, and onDisconnect.
A collection is used to keep a running list of the connections by adding
and deleting them in the onConnect and onDisconnect method. I saw a post
about using getOpenConnections, but I do not see a way to do this from the
xSocketDataHandler class. Is there a better way to maintain the list of
connections in order to send messages to them all?
Client: xChatClient.java, xSender.java, xClientHandler
Running the client will create an array of 40 connections. Those 40
connections will be passed to 40 threads which will each send a message to
the server, every few seconds, 100k times.
I started up my server on my dedicated server. Then on my development pc
(AMD 4200, 2gig ram) I started up 4 clients. After 10 minutes I checked on
the app and there was 120 connections. I checked top and the app was taking
up 213 virtual memory, 35 megs of ram, and 10megs of shared memory. After
20 minutes I checked and the connections were down to 47, the rest had
bombed out for some reason at some point. The app was now taking up 25 megs
of memory.
Is it better to test the clients on a separate machine going out over cable
modem to the server (the above test), or would it be better to run the
clients on the same machine as the server?
This is a link to my source code, I have kept it real simple for this test:
http://www.quickfilepost.com/download.do?get=acfb22c50e233175e293d41a04b00aa9
Thanks!
|
|
From: Bhatnagar, V. (Ved) <vbh...@av...> - 2009-03-26 16:30:27
|
Yes, We did try it and still we do not get the OnDisconnect or any other exceptions in server side, when Client JVM is killed. Thank you, Ved From: Gregor Roth [mailto:gre...@gm...] Sent: Wednesday, March 25, 2009 12:35 PM To: Bhatnagar, Ved (Ved) Cc: xso...@li... Subject: Re: FW: OnDisconnect is not being called in multiplex scenario Hi Ved, did you already consult the xSocket Tutorial - Chapter 8 (http://xsocket.sourceforge.net/core/tutorial/V2/TutorialCore.htm)? Does this answer your questions? Gregor ----- Original Message ----- From: Bhatnagar, Ved (Ved) Sent: 25/03/09 07:06 am To: Gregor Roth Subject: FW: OnDisconnect is not being called in multiplex scenario Need your help . From: Bhatnagar, Ved (Ved) Sent: Monday, March 23, 2009 4:50 PM To: 'xso...@li...' Subject: OnDisconnect is not being called in multiplex scenario Hi, We are running a prototype to further our understanding of xScoket library. We are stuck in disconnect scenario testing. We have a simple Multiplexed client and a simple Multiplexed server using pipelines( code copied from samples provided in documentation). We are trying to see how to handle disconnects in following three scenarios. 1. Client does graceful close on pipeline. This Scenario is working as Server protocol handler invokes OnDisconnect for the correct pipeline. 2. Client crashes ( we kill the client JVM) .. This scenario is not working as Server protocol handler does not invoke any callbacks. 3. Network cable is unplugged between client and server. We have not yet tested it. Please advise as to how to handle such scenarios. Thank you, Ved / Bobby |
|
From: Gregor R. <gre...@gm...> - 2009-03-25 19:34:52
|
|
From: Bhatnagar, V. (Ved) <vbh...@av...> - 2009-03-23 23:49:49
|
Hi, We are running a prototype to further our understanding of xScoket library. We are stuck in disconnect scenario testing. We have a simple Multiplexed client and a simple Multiplexed server using pipelines( code copied from samples provided in documentation). We are trying to see how to handle disconnects in following three scenarios. 1. Client does graceful close on pipeline. This Scenario is working as Server protocol handler invokes OnDisconnect for the correct pipeline. 2. Client crashes ( we kill the client JVM) .. This scenario is not working as Server protocol handler does not invoke any callbacks. 3. Network cable is unplugged between client and server. We have not yet tested it. Please advise as to how to handle such scenarios. Thank you, Ved / Bobby |
|
From: Gregor R. <gre...@gm...> - 2009-03-17 05:09:51
|
------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com |
|
From: John M. <joh...@gm...> - 2009-03-16 17:44:11
|
This is happening in my code, is there any normal situation in which this would occur? It is called when my server starts, but sometime after it stops getting called. |
|
From: Gregor R. <gre...@gm...> - 2009-03-15 16:37:43
|