JulianWohlleber / oscp5

Automatically exported from code.google.com/p/oscp5
0 stars 0 forks source link

Send large amount of data, I see an exception / nothing happens #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I try to send some image data from a client to server. both use the oscp5 lib 
(0.9.8). this is the sending part:

------
  OscMessage myMessage = new OscMessage("/OSC_GENERATOR");

  byte[] bfr = new byte[4096];
//  int[] bfr = new int[4096];
  myMessage.add(bfr); /* add an int array to the osc message */
print("snd");
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation); 
println("dne");

------

What is the expected output? What do you see instead?
not an exception, if i use a byte array I see the error

### [2013/2/4 19:32:12] ERROR @ UdpServer.run() ArrayIndexOutOfBoundsException: 
 java.lang.ArrayIndexOutOfBoundsException

if i use an int array, nothing is visible.

What version of the product are you using? On what operating system?
osx 10.8

Please provide any additional information below.
I checked with wireshark that packets are sent.

Original issue reported on code.google.com by michudr...@gmail.com on 4 Feb 2013 at 6:37

GoogleCodeExporter commented 8 years ago
This patch adds 
-a santiy check before the buffer is copied (if the buffer is too small for the 
udp package content)
-add some more verbose logging (if packet is invalid or exceptions happens)

Original comment by michudr...@gmail.com on 5 Feb 2013 at 2:06

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, please have a look at the oscP5properties example, you are looking for 
setDatagramSize. By default the datagram size for oscP5 is set to 1536 - hence 
in your case too small for sending 4096 bytes.
http://www.sojamo.de/libraries/oscP5/examples/oscP5properties/oscP5properties.pd
e

Original comment by soj...@gmail.com on 12 Feb 2013 at 9:05

GoogleCodeExporter commented 8 years ago
Yes I saw this. I think it would be helpfull for the user if the lib print out 
a warning message if the buffer is too small. 

There was also another sideeffect that the lib throws some ArrayOutOfBound 
Exceptions if the buffer is too small.

this patch should address both issues.

cheers
michu

Original comment by michudr...@gmail.com on 12 Feb 2013 at 9:08