xsocket-develop Mailing List for xsocket (Page 18)
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...@go...> - 2008-03-29 09:01:53
|
Hi Raoul, I added xSocket's understanding of alpha/beta/final to the home page. See http://xsocket.sourceforge.net/UnderstandingOfAlphaBetaFinal.htm The state of the current xSocket's component is as follows: - the final version xSocket core 2.0 will be release in march/2008. Only minor issues are open (typo checks, JavaDoc, tutorial update). - The first beta of xSocket multiplexed will be release in march/2008. Planning for the final version is round about 1-2 month later. - The next version of xSocket http will also be released in march/2008. The component will stay in alpha mode (beta will be available in round about 1-2 months later). The alpha is full functional. Bugs are not known for the current implementation. But more test/example/early applications are required to see that the API is high flexible and high usable. Major API changes are not expected for xSocket http, but it can not be excluded. For this reasons xSocket http stays in alpha mode. Feedback and support of the community is very welcome. As more community feedback and support as shorter the pre final phases I hope this helps Gregor 2008/3/29, Raoul Duke <ra...@gm...>: > > hi, > > i'm interested in xSocket for implementing client async HTTP requests. > what does alpha/beta mean? :-) when do you think things will get out > of alpha/beta? > > many thanks! > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > |
|
From: Raoul D. <ra...@gm...> - 2008-03-28 23:16:51
|
hi, i'm interested in xSocket for implementing client async HTTP requests. what does alpha/beta mean? :-) when do you think things will get out of alpha/beta? many thanks! |
|
From: Gregor R. <gre...@go...> - 2008-03-19 06:57:04
|
Hi all, xSocket V2.0-beta-2, xSocket-http V2.0-alpha-4 and xSocket-multiplexed V2.0-alpha-4 has been released. xSocket is an easy to use NIO-based network library to build high performance, highly scalable network applications. It supports writing synchronous and asynchronous client-side applications as well as server-side applications in a very intuitive way. xSocket supports UDP, TCP (SSL), multiplexed TCP and the HTTP protocol. For more information refer to xSocket's homepage (www.xsocket.org) and tutorials. Gregor |
|
From: Gregor R. <gre...@go...> - 2008-03-19 06:54:54
|
Hi Ricardo, the NonBlockingConnection and the BlockingConnection implements the NIO interfaces ReadableByteChannel and WritableByteChannel. By using the NIO utility class Channels these channels can be mapped into classic input and output streams. Because the classic streams do have a blocking behaviour, the mapping to an input stream should only be done based on the BlockingConnection. See http://xsocket.svn.sourceforge.net/viewvc/xsocket/xsocket/core/trunk/src/test/java/org/xsocket/connection/ClassicStreamTest.java?view=markup for an example. Please note, that you will lost the benefit of the non blocking reading (especially on the server side) by doing this. Means, by mapping a NonBlockingConnection (after wrapping it with a BlockingConnection) to a stream each open connection consumes a dedicated thread. This is the same behaviour like the classic stream approach. For this reason the scalability is as good/bad as for classic streams. Unfortunately, just mapping the channels to streams will not improve the scalability or response time. But this can be a first step of a refactoring. cheers Gregor 2008/3/19, Ricardo Lecheta <ric...@te...>: > > Hi all, > > I have a J2ME application that use a socket to communicate with the my > server application. > > Both applications read/write using the DataInputStream/DataOutputStream. > > I would like to refactor the server side to some high performance NIO > framework like xserver, > but I didn't find anything to use the DataInputStream, just the readStringByDelimiter > methods. > > is there a way to just refactor my server application without change my > client? > > thank you, > Ricardo > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > > |
|
From: Ricardo L. <ric...@te...> - 2008-03-19 02:10:03
|
Hi all, I have a J2ME application that use a socket to communicate with the my server application. Both applications read/write using the DataInputStream/DataOutputStream. I would like to refactor the server side to some high performance NIO framework like xserver, but I didn't find anything to use the DataInputStream, just the readStringByDelimiter methods. is there a way to just refactor my server application without change my client? thank you, Ricardo |
|
From: Gregor R. <gre...@go...> - 2008-03-04 14:58:46
|
Hi all, xSocket V2.0-beta-1, xSocket-http V2.0-alpha-3 and xSocket-multiplexed V2.0-alpha-3 has been released. xSocket is an easy to use NIO-based network library to build high performance, highly scalable network applications. It supports writing synchronous and asynchronous client-side applications as well as server-side applications in a very intuitive way. xSocket supports UDP, TCP (SSL), multiplexed TCP and the HTTP protocol. For more information refer to xSocket's new homepage (www.xsocket.org) and tutorials. Gregor |
|
From: Gregor R. <gre...@go...> - 2008-03-04 06:03:42
|
Wang, thanks for the report. The typo has been fixed. The tutorial has also been updated to cover the new beta-1 version. Gregor 2008/3/4, yud...@ns... <yud...@ns...>: > > Hi: > > I am a new user of XSocket, when I study the core > tutorial on > http://xsocket.sourceforge.net/core/tutorial/V2/TutorialCore.htm, in the > section â*7. Handling timeout's*â, the sample code is : > > // the handler > > class Handler implements IDataHandler, IIdleTimeoutHandler, > IConnectionTimeoutHandler { > > > > *public boolean onConnectionTimeout(INonBlockingConnection nbc) throws > IOException* { > > nbc.write("bye bye"); > > nbc.close(); > > > > return true; // prevent, that xSocket also closes the connection > > } > > > > > > *public boolean onConnectionTimeout(INonBlockingConnection nbc) throws > IOException* { > > nbc.write("What's going on? Why don't you send data?"); > > > > connection.setIdleTimeoutSec(30); // resets the timeout counter > > return true; // prevent, that xSocket closes the connection > > } > > > > > > public boolean onData(INonBlockingConnection nbc) throws IOException { > > ... > > > > return true; > > } > > } > > > > > > // and the server > > IServer server = new Server(8090, new Handler()); > > server.setIdleTimeoutSec(30); // set the default idle timeout for > server-side connections > > server.run(); > > > > > > These 2 function are same, but I think the second should be â *public* > *boolean* onIdleTimeout(INonBlockingConnection arg0)â, is it right? > > > > Thanks. > > > > Best regards > ======================= > Wang Yudong > 15882146156 > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > > |
|
From: <yud...@ns...> - 2008-03-04 02:31:25
|
Hi:
I am a new user of XSocket, when I study the core
tutorial on
http://xsocket.sourceforge.net/core/tutorial/V2/TutorialCore.htm, in the
section "7. Handling timeout's", the sample code is :
// the handler
class Handler implements IDataHandler, IIdleTimeoutHandler,
IConnectionTimeoutHandler {
public boolean onConnectionTimeout(INonBlockingConnection nbc)
throws IOException {
nbc.write("bye bye");
nbc.close();
return true; // prevent, that xSocket also closes the
connection
}
public boolean onConnectionTimeout(INonBlockingConnection nbc)
throws IOException {
nbc.write("What's going on? Why don't you send data?");
connection.setIdleTimeoutSec(30); // resets the timeout counter
return true; // prevent, that xSocket closes the connection
}
public boolean onData(INonBlockingConnection nbc) throws IOException
{
...
return true;
}
}
// and the server
IServer server = new Server(8090, new Handler());
server.setIdleTimeoutSec(30); // set the default idle timeout for
server-side connections
server.run();
These 2 function are same, but I think the second should be " public
boolean onIdleTimeout(INonBlockingConnection arg0)", is it right?
Thanks.
Best regards
=======================
Wang Yudong
15882146156
|
|
From: Thomas S. <ts...@ib...> - 2008-02-18 15:10:28
|
Hello,
I have the following onData() handler:
EODProtocolContent ch = (EODProtocolContent) con.getAttachment();
if (ch == null) {
ch = new EODProtocolContent(con.getRemoteAddress().getHostName());
}
int commandIndex = ch.getCommandIndex();
switch (commandIndex) {
case MCIProtocol.MCI_COM_MACADDRESS : // MAC address
ch.getEodDataPacket().setMacAddress(con.readStringByDelimiter(newLine));
// Authentication
if
(!ch.getEodDataPacket().authenticate(ch.getEodDataPacket().getMacAddress()))
{
ch.setReturnCode(MCIProtocol.MCI_RC_AUTHENTICATION_FAILED);
}
break;
case MCIProtocol.MCI_COM_CHECKSUM: // Checksum
...
}
...
if (ch.getReturnCode() < 0) {
con.setAttachment(null);
} else {
ch.setCommandIndex(commandIndex + 1);
con.setAttachment(ch);
}
if ((ch.getReturnCode() < 0) || (ch.getCommandIndex() ==
MCIProtocol.MCI_COM_ENDOFPACKET)) {
// Write the return code if there was an error message or everything
went fine
con.write(String.valueOf(ch.getReturnCode()) + newLine);
con.flush();
}
Basically, EODProtocolContent is a wrapper around another object called
EODDataPacket and a few scalar data members. EODDataPacket has a few
setters and getters and also methods which accesses a database.
ch.getEodDataPacket() is simply a getter for returning the instance of a
EODDataPacket in EODProtocolContent.
With a self-written load testing tool, which basically send e.g. a MAC
address (the first line in a self-defined protocol), it sometimes happen
that ch.getEodDataPacket().authenticate(...) fails with an error
message, because there is rubbish in the macAddress data member. E.g.:
x?????q?oq?7???B?[A?L"6 ????Ev??9?#N?????k?j?/????_}?????_}????????}???~????~??????~???????????o???|??????~?????????_???????#?4???l?/v|??g?5?????????????????????%??????????_????????????}?????w?|?????}???>?????_??????^_???u>??_TO???G???_??3:???????_lt???[????_l4?3???}?~b?F?????J>oz{??X?Ry+????o{F_?4?[?sxV?s?????????V???~z?7??[???hx??>g??=?????Y?O%?5=????{S?c3??6#????????_??:???-o[????aZb?T?
?0?U??:?u-#?5/?*8M?}???}-?4??????=?~?~??0??o1???V?5?'??}??z?{???)?zL??{'?????}M3V??}?K-F,??6?5??)??O?:???ok,?
7\??f?Oz?E??l???1????]3TKC????YE??iB?j?i???z??#&?jg?a???2???m?b?f??????j?}Bw??k?
??Zo?ZE??U??f\?
V?j|@?N?U?????W?V?g????[???}?zV?U????K?4c?N?-3?:?}?t?%?s?k???Zs?u?Mk]f,q?{???<?7????t?}??G??ps?Q??1???k-5
For instance, if open 100 connections and send every 50 ms data to the
server, the above sometimes happen and sometimes not.
Any ideas what can cause this? Some kind of multi-threading issues?
@Gregor: I'm sorry for my last reply directly to your private email
address. This happens when I simply click reply in a posting in the list.
Thanks,
Thomas
|
|
From: Gregor R. <gre...@go...> - 2008-02-18 07:01:03
|
... close(). The most connection-related xSocket artefacts implement the java.io.Closeable interface. Gregor 2008/2/18, young lee <mai...@gm...>: > > Hi to all, > > I wrote some application with xSocket, and executed > > com.xsocket.connection.Server server = new Server(port, handler); > server.run(); > > but i cannot find out any shutdown() or stop() in > org.xsocket.connection.Server > How can i server stop gracefully ?? > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > > |
|
From: young l. <mai...@gm...> - 2008-02-18 02:56:02
|
Hi to all, I wrote some application with xSocket, and executed com.xsocket.connection.Server server = new Server(port, handler); server.run(); but i cannot find out any shutdown() or stop() in org.xsocket.connection.Server How can i server stop gracefully ?? |
|
From: Gregor R. <gre...@go...> - 2008-02-17 16:36:52
|
Hi Thomas, I would suggest to read the header data as a chunk, to avoid implementing a complex state machine. This can be done by using the read mark support. For an example see the tutorial and the implementation of the ConectionUtils method validateSufficientDatasizeByIntLengthField() ( http://xsocket.svn.sourceforge.net/viewvc/xsocket/xsocket/core/trunk/src/main/java/org/xsocket/connection/ConnectionUtils.java?view=markup ). To read the content I would attach the content handler to the connection. See below Gregor Example: MyProtocolHandler implements IDataHandler { public boolean onData(INonBlockingConnection connection) throws IOException, BufferUnderflowException { ContentHandler ch = (ContentHandler) connection.getAttachment(); // content handling mode? if (ch != null) { return ch.onData(connection); } // no -> read the header as chunk connection.resetToReadMark(); // reset (if former reads has been failed) connection.markReadPosition(); // if not enough data is available a BufferUnderFlowException will be thrown String identifier = connection.readStringByDelimiter("\r\n"); String checksum = connection.readStringByDelimiter("\r\n"); String length = ... connection.removeReadMark(); // all read! ContentHandler ch = new ContentHandler(length, checksum) connection.setAttachment(ch); ch.onData(connection); return true; } class ContentHandler implements IDataHandler { private int remaining = 0; private int checkSum = 0; private ... ContentHandler(int length,int checkSum, ...) { this.remaining = length; ... // create the inflator ... } public boolean onData(INonBlockingConnection connection) throws IOException, BufferUnderflowException { int available = connection.available(); int readSize = available; if (available > remaining) { readSize = reamaining } byte bytes = connection.readBytesByLength(readSize); reamaining -= readSize; // call inflator ... if (remaining == 0) { connection.setAttachment(null); } return true; } } } 2008/2/17, Thomas Steinmaurer <ts...@ib...>: > > Hello, > > I'm in the process of writing a socket server which basically receives > data according to a self-defined protocol from mobile devices. The data > is a mix of line-oriented character data (terminated with a '\n') and > some kind of payload, which is a ZLib compressed byte stream. > > E.g., the client sends the following data in the following sequence to > the server. > > Identifier\n > Checksum value\n > Length of compressed payload\n > ZLib compressed payload byte stream > > In a first step, I have written a multi-threaded socket server, which > uses common IO classes like DataInputStream. Performance is ok on a > local area network, but due to the blocking issue of any read method of > a DataInputStream, performance is pretty bad, especially in a > low-bandwith network. > > So I came across NIO and xSocket as one framework using Java NIO. > > How can I implement a socket server with xSocket which: > > * Implements the protocol as shown above (mix of line-oriented > characters and a ZLib compressed byte stream) > * Is non-blocking, so at least a few number of simultaneous clients are > handled gracefully > * Of course, each client needs to be isolated from each other > > > > Any hints, code snippets, ... are much appreciated. > > > Thank you very much. > > Regards, > Thomas > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > |
|
From: Thomas S. <ts...@ib...> - 2008-02-17 12:28:38
|
Hello, I'm in the process of writing a socket server which basically receives data according to a self-defined protocol from mobile devices. The data is a mix of line-oriented character data (terminated with a '\n') and some kind of payload, which is a ZLib compressed byte stream. E.g., the client sends the following data in the following sequence to the server. Identifier\n Checksum value\n Length of compressed payload\n ZLib compressed payload byte stream In a first step, I have written a multi-threaded socket server, which uses common IO classes like DataInputStream. Performance is ok on a local area network, but due to the blocking issue of any read method of a DataInputStream, performance is pretty bad, especially in a low-bandwith network. So I came across NIO and xSocket as one framework using Java NIO. How can I implement a socket server with xSocket which: * Implements the protocol as shown above (mix of line-oriented characters and a ZLib compressed byte stream) * Is non-blocking, so at least a few number of simultaneous clients are handled gracefully * Of course, each client needs to be isolated from each other Any hints, code snippets, ... are much appreciated. Thank you very much. Regards, Thomas |
|
From: Gregor R. <gre...@go...> - 2008-02-04 11:16:39
|
Hi, currently only a SPI for the connection package exists. The reason to separate the SPI for connection and datagram-oriented communication is that an all-in-one SPI interface would be too inflexible (the datagram one would be much smaller, because it doesn't have to handle connection-related issues such like connection timeouts). A SPI for the datagram hasn't been required yet. Do you need such an SPI? Doesn't the xSocket datagram implementation work for you? I wrote an article last year about NIO server architecture which fits very well with xSocket ( http://today.java.net/pub/a/today/2007/02/13/architecture-of-highly-scalable-nio-server.html). It is focused on connection-oriented communication, but the core architecture (dispatcher & worker pool) is the same for the datagram and connection-oriented approach. Unfortunately a xSocket datagram tutorial doesn't exits. xSocket is still looking for code and doc contributors. Cheers Gregor 2008/2/4, Yuriy Cherniavsky <yur...@gm...>: > > Hi Gregor. > > I try wrote some test datagram application with xSocket, and was really > surprise that SPI interface includes only for connection package. > What is the reason for such architecture? > > Yet one question, does exist any architecture diagram of xSocket > framework? > It be very comfortable to start from :-) > > Truly yours, Yuriy. > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > |
|
From: Yuriy C. <yur...@gm...> - 2008-02-04 09:08:57
|
Hi Gregor. I try wrote some test datagram application with xSocket, and was really surprise that SPI interface includes only for connection package. What is the reason for such architecture? Yet one question, does exist any architecture diagram of xSocket framework? It be very comfortable to start from :-) Truly yours, Yuriy. |
|
From: Gregor R. <gre...@go...> - 2008-02-02 12:21:54
|
Hi Yuriy, xSocket next major version 2.0 will be released in about 2 or 3 month. A second alpha version is already available. The alpha version is already quite stable and fast(er), but minor API changes could be made. Major API changes are not expected. The major open topic is the JMX support. The version 2.0 will be accompanied by 2 extension modules HTTP and MULTIPLEXED. Such extension modules are located on the top of xSocket core. Goal is, to keep the xSocket core small and independent. xSocket doesn't require 3rd party libraries. It is known, that xSocket is used by commercial projects. The initial version of xSocket is a spin-off, of a commercial high performance smtp server evaluation project. Sure, xSocket's community is smaller than MINA ones. xSocket major goal is to simplify the user API by supporting high scalablity and performance based on NIO. xSocket doesn't try to get the last 5% of performance regardless of the cost. This doesn't mean xSocket is not fast. xSocket is fast and scalable. It just means that other quality requirements such as maintability or simplicity are also appreciated by xSocket. xSocket supports a SPI interface to plugin lower level NIO-Provider. Very early experimental implementation based on Grizzly and MINA have been realized. I hope this helps you by making your decision cheers Gregor 2008/2/2, Yuriy Cherniavsky <yur...@gm...>: > > Hi xSocket community. > > I read about xSocket framework in Mina mail list, so look at xSochet web > site and then deeper in source code, and find it very suitable for my > project. > Can team leader of xSocket project explain the roadmap of it? > Does any project already use this framework? > > Truly yours, Yuriy. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > |
|
From: Yuriy C. <yur...@gm...> - 2008-02-02 09:08:33
|
Hi xSocket community. I read about xSocket framework in Mina mail list, so look at xSochet web site and then deeper in source code, and find it very suitable for my project. Can team leader of xSocket project explain the roadmap of it? Does any project already use this framework? Truly yours, Yuriy. |
|
From: Gregor R. <gre...@go...> - 2008-01-29 07:04:39
|
xSocket V2.0-alpha-2 has been released. Base on the new core release, a HTTP and a multiplexed extension module has been introduced. xSocket is an easy to use NIO-based network library to build high performance, highly scalable network applications. It supports writing synchronous and asynchronous client-side applications as well as server-side applications in a very intuitive way. xSocket supports UDP, TCP (SSL), multiplexed TCP and the HTTP protocol. For more information refer to xSocket's new homepage (www.xsocket.org) and tutorials. |
|
From: Gregor R. <gre...@go...> - 2008-01-18 10:46:21
|
Hi,
I updated the current trunk of V1.2 and 2.0 to throw an
IllegalArgumentException if the length is negative.
cheers
Gregor
2008/1/18, PyungMoon Oh <qud...@gm...>:
>
> i found it..
>
> in the below source code..remainingToExtract value was minus value..
>
>
> public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer> inOutBuffer,
> int length) throws IOException, BufferUnderflowException {
>
> LinkedList<ByteBuffer> result = new LinkedList<ByteBuffer>();
>
> int remainingToExtract = length;
> ByteBuffer buffer = null;
>
> do {
> // get the next buffer
> buffer = inOutBuffer.remove();
> if (buffer == null) {
> throw new BufferUnderflowException();
> }
>
> // can complete buffer be taken?
> int bufLength = buffer.limit() - buffer.position();
> if (remainingToExtract >= bufLength) {
> // write taken into out channel
> result.addLast(buffer);
> remainingToExtract -= bufLength;
>
> // .. no
> } else {
> int savedLimit = buffer.limit();
>
> // extract the takenable
> buffer.limit(buffer.position() + remainingToExtract);
> ByteBuffer leftPart = buffer.slice();
> result.addLast(leftPart);
> buffer.position(buffer.limit());
> buffer.limit(savedLimit);
> ByteBuffer rightPart = buffer.slice();
> inOutBuffer.addFirst(rightPart);
> break;
> }
>
> } while (remainingToExtract > 0);
>
> return result;
> }
>
> ---------- Forwarded message ----------
> From: PyungMoon Oh <qud...@gm...>
> Date: 2008. 1. 18 17:31
> Subject: i got an error with xSocket V1_2_1
> To: xso...@li...
>
> i got an error message like this..
> but i think it can not be happen if there is no another thread which is
> accessing the buffer..
> as i know "public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer>
> inOutBuffer, int length) throws IOException, BufferUnderflowException {"
> method check limit before call " java.nio.Buffer.limit" method..
> am i right??
>
> but i can not find it..
>
> can someone tell me why it's happening?? and which threads are accessing
> the buffer?
>
> java.lang.IllegalArgumentException
> at java.nio.Buffer.limit(Buffer.java:249)
> at org.xsocket.stream.ByteBufferParser.extract(
> ByteBufferParser.java:167)
> at org.xsocket.stream.Connection.extractBytesByLength(
> Connection.java:915)
> at org.xsocket.stream.NonBlockingConnection.readByteBufferByLength
> (NonBlockingConnection.java:574)
> at org.xsocket.stream.NonBlockingConnection.readBytesByLength(
> NonBlockingConnection.java:609)
>
>
> thanks//
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> xSocket-develop mailing list
> xSo...@li...
> https://lists.sourceforge.net/lists/listinfo/xsocket-develop
>
>
|
|
From: PyungMoon O. <qud...@gm...> - 2008-01-18 08:40:35
|
i found it..
in the below source code..remainingToExtract value was minus value..
public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer> inOutBuffer,
int length) throws IOException, BufferUnderflowException {
LinkedList<ByteBuffer> result = new LinkedList<ByteBuffer>();
int remainingToExtract = length;
ByteBuffer buffer = null;
do {
// get the next buffer
buffer = inOutBuffer.remove();
if (buffer == null) {
throw new BufferUnderflowException();
}
// can complete buffer be taken?
int bufLength = buffer.limit() - buffer.position();
if (remainingToExtract >= bufLength) {
// write taken into out channel
result.addLast(buffer);
remainingToExtract -= bufLength;
// .. no
} else {
int savedLimit = buffer.limit();
// extract the takenable
buffer.limit(buffer.position() + remainingToExtract);
ByteBuffer leftPart = buffer.slice();
result.addLast(leftPart);
buffer.position(buffer.limit());
buffer.limit(savedLimit);
ByteBuffer rightPart = buffer.slice();
inOutBuffer.addFirst(rightPart);
break;
}
} while (remainingToExtract > 0);
return result;
}
---------- Forwarded message ----------
From: PyungMoon Oh <qud...@gm...>
Date: 2008. 1. 18 17:31
Subject: i got an error with xSocket V1_2_1
To: xso...@li...
i got an error message like this..
but i think it can not be happen if there is no another thread which is
accessing the buffer..
as i know "public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer>
inOutBuffer, int length) throws IOException, BufferUnderflowException {"
method check limit before call " java.nio.Buffer.limit" method..
am i right??
but i can not find it..
can someone tell me why it's happening?? and which threads are accessing the
buffer?
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:249)
at org.xsocket.stream.ByteBufferParser.extract(ByteBufferParser.java
:167)
at org.xsocket.stream.Connection.extractBytesByLength(
Connection.java:915)
at org.xsocket.stream.NonBlockingConnection.readByteBufferByLength(
NonBlockingConnection.java:574)
at org.xsocket.stream.NonBlockingConnection.readBytesByLength(
NonBlockingConnection.java:609)
thanks//
|
|
From: PyungMoon O. <qud...@gm...> - 2008-01-18 08:31:18
|
i got an error message like this..
but i think it can not be happen if there is no another thread which is
accessing the buffer..
as i know "public LinkedList<ByteBuffer> extract(LinkedList<ByteBuffer>
inOutBuffer, int length) throws IOException, BufferUnderflowException {"
method check limit before call "java.nio.Buffer.limit" method..
am i right??
but i can not find it..
can someone tell me why it's happening?? and which threads are accessing the
buffer?
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:249)
at org.xsocket.stream.ByteBufferParser.extract(ByteBufferParser.java
:167)
at org.xsocket.stream.Connection.extractBytesByLength(
Connection.java:915)
at org.xsocket.stream.NonBlockingConnection.readByteBufferByLength(
NonBlockingConnection.java:574)
at org.xsocket.stream.NonBlockingConnection.readBytesByLength(
NonBlockingConnection.java:609)
thanks//
|
|
From: Gregor R. <gre...@go...> - 2008-01-10 15:53:50
|
Hi Simon, thanks for your feedback concerning the documentation. I'm currently updating xSocket's documentation/homepage. Your question should (hopefully) be answered by the updated and not yet released new documentation/homepage: http://xsocket.sourceforge.net/indexNew.html -> see xSocket (core) V2.0-alpha-2 tutorial. If not, don't hesitate to contact me. Gregor 2008/1/10, Simon Ward <si...@tr...>: > > Hi, > > I have just started experimenting with xSocket and I have managed to > create a rudimentary pub/sub system in two days so it is looking good so > far. However, I did have one comment and one question. > > Firstly, I worked out how to handle the case where a large data block > has not arrived yet. I think this could be a bit clearer in the > documentation though because initially I though that I should make the > IDataHandler onData method wait and loop until more data was in the > buffer if I got a buffer underflow. However, I found that the buffer > never got any more data presumably due to your internal locking. I did > eventually work out that the StreamUtils.validate... method actually > works by throwing the BufferUnderflowException that causes that call to > onData to abort; then onData is called again when more data arrives, and > this repeats until the whole block of data has arrived and it can be > processed normally. > > My question is: what happens if a large data block is followed by a > small data block? I presume that the sender will buffer the data so > that the small data block arrives immediately after the large data > block, so the two blocks arrive as a continuous stream. My handler will > keep attempting to read the large data block until it has arrive. > However, in the last call to onData, which can finally real the large > data block, the buffer may also contain the entire small data block > too? I assume that onData will only be called when more data arrives at > the socket. Therefore, if the small data block has already arrived, > onData will not be called again? Do I need to check for more data in > the buffer with getNumberOfAvailableBytes() and then have onData > recursively call itself, or will your framework automatically call > onData again if my handler returns with unread data in the buffer? > > Regards, > Simon. > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > |
|
From: Simon W. <si...@tr...> - 2008-01-10 12:06:21
|
Hi,
I have just started experimenting with xSocket and I have managed to
create a rudimentary pub/sub system in two days so it is looking good so
far. However, I did have one comment and one question.
Firstly, I worked out how to handle the case where a large data block
has not arrived yet. I think this could be a bit clearer in the
documentation though because initially I though that I should make the
IDataHandler onData method wait and loop until more data was in the
buffer if I got a buffer underflow. However, I found that the buffer
never got any more data presumably due to your internal locking. I did
eventually work out that the StreamUtils.validate... method actually
works by throwing the BufferUnderflowException that causes that call to
onData to abort; then onData is called again when more data arrives, and
this repeats until the whole block of data has arrived and it can be
processed normally.
My question is: what happens if a large data block is followed by a
small data block? I presume that the sender will buffer the data so
that the small data block arrives immediately after the large data
block, so the two blocks arrive as a continuous stream. My handler will
keep attempting to read the large data block until it has arrive.
However, in the last call to onData, which can finally real the large
data block, the buffer may also contain the entire small data block
too? I assume that onData will only be called when more data arrives at
the socket. Therefore, if the small data block has already arrived,
onData will not be called again? Do I need to check for more data in
the buffer with getNumberOfAvailableBytes() and then have onData
recursively call itself, or will your framework automatically call
onData again if my handler returns with unread data in the buffer?
Regards,
Simon.
|
|
From: Gregor R. <gre...@go...> - 2008-01-07 11:40:29
|
Hi, yes, there should be a NonBlockingConnection constructor which accepts a handler and a SSLContext :-( The upcoming V2.0-alpha-2 (release date: mid of February/08) supports such a constructor. The NonBlockingConnection of the V1.2 branch has already been updated to support this case. But the release date of the maintainance release V1.2.2 is not fixed yet. cheers Gregor 2008/1/7, Mohamad Azri Bin Azhar <az...@gm...>: > > Dear all, > > I'm trying to create a NonBlockingConnection client with onData() > handler and SSL enabled, how do I go about it? There is no such > constructor that accept SSLContext and the IDataHandler at the same time. > > Without SSL, I could just call NonBlockingConnection(host, port, this). > > Thanks. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > xSocket-develop mailing list > xSo...@li... > https://lists.sourceforge.net/lists/listinfo/xsocket-develop > |
|
From: Mohamad A. B. A. <az...@gm...> - 2008-01-07 10:36:00
|
Dear all, I'm trying to create a NonBlockingConnection client with onData() handler and SSL enabled, how do I go about it? There is no such constructor that accept SSLContext and the IDataHandler at the same time. Without SSL, I could just call NonBlockingConnection(host, port, this). Thanks. |