-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message Buffer Issue. #2
Comments
This was the error: |
I'll have a look at it - but I have used this design to send millions of messages to a server without a single hickup. To be fair though, I was using IAP as network protocol instead of HTTP. Seeing that your error occurs in the HttpMessageReader hints that this might be where the issue is hidden. |
Oh, it will take me at least 1-2 weeks before I have time to look into it... please see if you can find out what the error is yourself too, and if you do, please let me know! |
First of I am using this Server as a TCP server. I have worked, it might be a solution but I am not sure, as it gave birth to a new issue, which I couldn't resolve yet! In MessageBuffer class I commented return null and it resolved more socket generation issue;
As mentioned earlier this gave birth to a new issue; when we send simultaneous messages at the same time otherwise it works okay. And the issue is in Message Class here;
And this gives an error of out of array index. I will post the error as soon as I regenerate this issue. |
Hellio Jjenkov,
I was using your server, I like the way you have coded it but there is an issue I found out when I bombarded the server with multiple clients. It can receive the total of 512 messages.
Furthermore, I found out that if I change the size of:
public static int KB = Constant.maxLimit; public static int MB = Constant.maxLimit * KB; byte[] smallMessageBuffer = new byte[Constant.maxLimit * 4 * KB]; QueueIntFlip smallMessageBufferFreeBlocks = new QueueIntFlip(Constant.maxLimit);
The maxLimit is:
public class Constant { public static int maxLimit = 2048; }
In Server Class
Queue socketQueue = new ArrayBlockingQueue(Constant.maxLimit);
In SocketProcessor
private ByteBuffer readByteBuffer = ByteBuffer.allocate(Constant.maxLimit * Constant.maxLimit); private ByteBuffer writeByteBuffer = ByteBuffer.allocate(Constant.maxLimit * Constant.maxLimit); private double nextSocketId = 16 * Constant.maxLimit;
The client code I am using is:
client = SocketChannel.open(); isa = new InetSocketAddress("127.0.0.1", 9998); client.connect(isa); client.configureBlocking(false); sendMessage(); //here i send PING. client.close(); try { Thread.sleep(500); } catch (InterruptedException ex) { Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex); }
Please reply to the issue and help me accordingly.
The text was updated successfully, but these errors were encountered: