adrianchia / naga Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/naga
Automatically exported from code.google.com/p/naga
Please, add SSL support
mb this help
http://www.koders.com/java/fid34F043A6C385F08D020D57C2285A95DFB447EDB0.aspx?s=SS
LEngineImpl
Original issue reported on code.google.com by [email protected]
on 30 Jan 2011 at 11:31
This steps will reproduce the problem:
1. just send 3 packets to your server
2. on server side drop connection after receiving 2 packet
Naga says that all 3 packets sent, then disconnect.
On server side only 2 packets received.
You can see additional info here:
http://code.google.com/p/naga/issues/detail?id=8
Original issue reported on code.google.com by [email protected]
on 24 Mar 2011 at 9:03
Using 2.0_r39.
The JavaDoc for NIOService seems to have a minor typo:
Using regular sockets:
NIOService service = new NIOService;
NIOSocket serverSocket = service.openSocket("www.google.com", 1234);
socket.listen(myObserver);
// Asynchronous write by default:
socket.write("Some message".getBytes());
I think "serverSocket" should be just "socket".
Original issue reported on code.google.com by [email protected]
on 9 Feb 2010 at 3:05
PacketWriter use byte[] to return result to its delegate, but sometimes u need
to parse incoming xml/json data.
I propose to replace the bytearrays to objects, in this case the result of the
PacketReader is XML object.
for example
---------------------------------------------------------------------------
public class XMLPacketReader implements PacketReader
{
XMLObject xml = null;
private XMLPacketReader()
{
}
public Object nextPacket(ByteBuffer byteBuffer) throws ProtocolViolationException
{
// parse xml here
boolean isDone = XMLParser.parse(byteBuffer, xml);
if(isDone)
return xml;
return null;
}
}
---------------------------------------------------------------------------
Original issue reported on code.google.com by [email protected]
on 16 Jan 2013 at 11:14
What steps will reproduce the problem?
1. Use a RegularPacketWriter constructing it with a value of 4 to indicate
4 header bytes to describe the length of the payload.
2. Write any byte array of any length
What is the expected output? What do you see instead?
Expected it to write the packet asynchronously. Instead it failed throwing
an illegal argument exception: Payload size cannot be encoded into 4
byte(s).
What version of the product are you using? On what operating system?
Version 2.0 on Windows Vista
Please provide any additional information below.
The problem is in the static method NIOUtils.getByteBufferFromPacketSize:
...
if (valueToEncode >> (headerSize * 8) > 0)
throw new IllegalArgumentException(...);
In the case of specifying a 4 byte length in the header, headerSize will be
4. Per the JLS, if the type of the operand is int, then the shift amount
should be treated as if it were specified mod 32. Thus valueToEncode >> (4
* 8) is equivalent to valueToEncode >> 0, which of course is always greater
than zero for any size byte buffer... thus it always throws the exception.
For the case where the headerSize is 4, you don't need to check the size
because there can't be a size that would violate this that would still fit
into the int valueToEncode.
The quick hack fix of course is to cast valueToEncode to a long, and in
this case the JLS specifies that the shift amount should be treated as if
it were mode 64.
Original issue reported on code.google.com by stevemash
on 25 Apr 2010 at 4:55
Sometimes you need to use plain socket connection and it's very easy with naga.
But sometimes you need to secure existing plain connection, for example, when
user makes some actions that needs to be secure.
I try the following:
secureSocket = new SSLSocketChannelResponder(plainSocket,
sslContext.createSSLEngine(), true);
but it doesn't work.
Original issue reported on code.google.com by [email protected]
on 12 Mar 2011 at 7:19
From http://code.google.com/p/naga/ click on the "Javadocs" link. This takes
you to http://millenniummonkey.com/hosted/nagadocs/api/index.html which does
not exist.
Original issue reported on code.google.com by [email protected]
on 18 Feb 2010 at 3:12
I'm try to develop class for Apple Push Notification Service.
To create this class you need to:
1) open connection with apple server;
2) send packet to server;
3) handle disconnect or server response(if any error occurred, Apple server
drop connection);
With naga it's simple, but it doesn't work:
I'm open connection, send 5 packets to apple server(third packet with error for
testing), then I saw in console that all packets has been sent, but only 1 and
2 messages has been delivered, then Apple drops connection.
What's wrong?
Naga handle disconnection too late?
Or, maybe, method "packetSent" don't work properly?
PS: sorry for bad English.
Original issue reported on code.google.com by [email protected]
on 12 Mar 2011 at 7:39
What version of the product are you using? On what operating system?
naga-3_0-r48
Please provide any additional information below.
private void fillCurrentOutgoingBuffer() throws IOException
{
..........
else
{
data = (byte[])((Object[])nextPacket)[0];
tag = ((Object[])nextPacket)[0]; // <------ should be ((Object[])nextPacket)[1]
}
..........
}
Original issue reported on code.google.com by [email protected]
on 17 May 2011 at 10:11
Hi I just got a problem when using naga on android.
I have two android devices, one runs naga very well,
but the other one always got IllegalSelectorException when listen to socket.
So I searched the web says that it seems a problem wehn do
m_channelResponder.getChannel().register in RegisterChannelEvent class
the option parameter should not be 0 or it will fail.
What steps will reproduce the problem?
1. create a nioservice
2. open socket from nioService
3. listen to the socket
What is the expected output? What do you see instead?
It should be connect to socket without problem.
What version of the product are you using? On what operating system?
android 2.1-update1
Please provide any additional information below
Original issue reported on code.google.com by [email protected]
on 5 Nov 2011 at 7:13
If using selectBlocking() and then using NIOSocket#write(byte[]) from a
different thread, the selector
would not be awakened and consequently the write would not be performed.
This does not affect selectNonBlocking or if everything is single-threaded.
Original issue reported on code.google.com by [email protected]
on 29 Aug 2008 at 11:54
Hi,
I took a look at packaging naga for Debian/Ubuntu as Jmol is now using it.
However, neither the source code repository, nor the released jar files contain
any licensing or copyright information. The Google Code site says "MIT", but
this is insufficient for anybody reviewing or auditing naga for use in other
open source projects.
In the best case, each .java file would contain the MIT license (which is quite
short) as source-code comment at the top of the file, together with some
explicit copyright information like "Copyright (c) 2008-2011
Christoffer Lerno". At least, the MIT license should be included in the
top-level directory of the svn trunk/branches/tags directories and the released
jars (e.g. in a file called "COPYING"), possibly with a reference to it from
every .java file.
Finally, having a source-only release tarball or zipfile (basically just the
content of the subversion repository at the time) would be welcome, but is not
required.
Best regards,
Michael
Original issue reported on code.google.com by [email protected]
on 30 Oct 2011 at 7:36
What steps will reproduce the problem?
1. Declare a NIOService and a NIOSocket.
2. Instantiate the NIOService, selectNonBlocking, then do
service.openSocket(host,port)
3. The connection succeeds, then the Application force closes.
What is the expected output? What do you see instead?
Afther the connection, it should instantiate the SocketObserver, however, the
application crashes right after the connection.
What version of the product are you using? On what operating system?
I am using Naga 3.0 along with the version 8 of Android API (or Android 2.2).
I'm using the version 1.6 of OpenJDK and I'm coding on Ubuntu 12.04 x64.
Please provide any additional information below.
I'm going to try this with 2.1 version of Naga, and I'll keep you updated.
Original issue reported on code.google.com by [email protected]
on 2 Oct 2012 at 9:18
Attachments:
Sometimes you need to use plain socket connection and it's very easy with naga.
But sometimes you need to secure existing plain connection, for example, when
you connect to GTalk server:
1) you open plain connection and send required data to server
2) server reply to you with command that requires TLS
3) you need to start secure existing plain connection
Without naga I can do:
------------------------------------------------
private Socket socket;
...
Socket plain = socket;
// Secure the plain connection
socket = context.getSocketFactory().createSocket(plain,
plain.getInetAddress().getHostName(), plain.getPort(), true);
// Initialize the reader and writer with the new secured version
initReaderAndWriter();
// Proceed to do the handshake
((SSLSocket) socket).startHandshake();
...
------------------------------------------------
Original issue reported on code.google.com by [email protected]
on 24 Mar 2011 at 9:09
The ConnectionAcceptor Javadoc says that the default value (for
NIOServerSocket) is DENY but it appears to be ALLOW.
Original issue reported on code.google.com by [email protected]
on 18 Feb 2010 at 4:21
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.