javapgm
javapgm copied to clipboard
Negative size
This code is from Socket.java sendSpmr(Peer peer) ... SocketBuffer skb = SourcePathMessageRequest.create(); after this call skb len is -16
when later trying to create the datagram
DatagramPacket pkt = new DatagramPacket(skb.getRawBytes(),
skb.getDataOffset(), skb.getLength(), null,
this.udpEncapsulationMulticastPort);
I get illegal length or offset (see below)...
Hello World
skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": -16, "header": { "pgm_sport": 1314, "pgm_dport": 26230, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 47876, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 0, "end": 16, "length": 16 } }
Exception in thread "Thread-2" skb.getDataOffset()=16, skb.getLength()=-16
java.lang.IllegalArgumentException: illegal length or offset
at java.net.DatagramPacket.setData(DatagramPacket.java:264)
at java.net.DatagramPacket.
If I fix the code above, I get into another issue: peer.getNetworkLayerAddress() returns null (is not set) and after setting it to null with the statement below pkt.setAddress(peer.getNetworkLayerAddress());
I get the exception below.
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 16, "header": { "pgm_sport": 1314, "pgm_dport": 16785, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 57321, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 0, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=0, skb.getLength()=16 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
Thank you
Following the other packets types I think the call is supposed to be reserve() not pull().
On Tue, Mar 11, 2014 at 1:55 PM, viorelstolea [email protected]:
This code is from Socket.java sendSpmr(Peer peer) ... SocketBuffer skb = SourcePathMessageRequest.create(); after this call skb len is -16
when later trying to create the datagram
DatagramPacket pkt = new DatagramPacket(skb.getRawBytes(), skb.getDataOffset(), skb.getLength(), null, this.udpEncapsulationMulticastPort);
I get illegal length or offset (see below)...
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": -16, "header": { "pgm_sport": 1314, "pgm_dport": 26230, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 47876, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 0, "end": 16, "length": 16 } } Exception in thread "Thread-2" skb.getDataOffset()=16, skb.getLength()=-16 java.lang.IllegalArgumentException: illegal length or offset at java.net.DatagramPacket.setData(DatagramPacket.java:264) at java.net.DatagramPacket.(DatagramPacket.java:116) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2119) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
If I fix the code above, I get into another issue: peer.getNetworkLayerAddress() returns null (is not set) and after setting it to null with the statement below pkt.setAddress(peer.getNetworkLayerAddress());
I get the exception below.
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 16, "header": { "pgm_sport": 1314, "pgm_dport": 16785, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 57321, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 0, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=0, skb.getLength()=16 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
Thank you
Reply to this email directly or view it on GitHubhttps://github.com/steve-o/javapgm/issues/1 .
Thanks for replying. I changed the 'pull' to 'reserve' in SourcePathMessageRequest.create()
Now I still get the NullPointerException:
message received->Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 0, "header": { "pgm_sport": 1314, "pgm_dport": 55952, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 18154, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=16, skb.getLength()=0 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
This happens here in Socket.java:
/* Send unicast SPMR with regular TTL */ try { pkt.setAddress(peer.getNetworkLayerAddress()); this.send_sock.send(pkt); } catch (java.io.IOException e) { LOG.error(e.toString()); return false; }
because peer.getNetworkLayerAddress() returns null.
in Peer.java:
public InetAddress getNetworkLayerAddress() { return this.nla; }
this.nla is null!
Thanks again!
On Mon, Mar 17, 2014 at 1:47 PM, Steven McCoy [email protected]:
Following the other packets types I think the call is supposed to be reserve() not pull().
On Tue, Mar 11, 2014 at 1:55 PM, viorelstolea <[email protected]
wrote:
This code is from Socket.java sendSpmr(Peer peer) ... SocketBuffer skb = SourcePathMessageRequest.create(); after this call skb len is -16
when later trying to create the datagram
DatagramPacket pkt = new DatagramPacket(skb.getRawBytes(), skb.getDataOffset(), skb.getLength(), null, this.udpEncapsulationMulticastPort);
I get illegal length or offset (see below)...
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": -16, "header": { "pgm_sport": 1314, "pgm_dport": 26230, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 47876, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 0, "end": 16, "length": 16 } } Exception in thread "Thread-2" skb.getDataOffset()=16, skb.getLength()=-16 java.lang.IllegalArgumentException: illegal length or offset at java.net.DatagramPacket.setData(DatagramPacket.java:264) at java.net.DatagramPacket.(DatagramPacket.java:116) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2119) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
If I fix the code above, I get into another issue: peer.getNetworkLayerAddress() returns null (is not set) and after setting it to null with the statement below pkt.setAddress(peer.getNetworkLayerAddress());
I get the exception below.
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 16, "header": { "pgm_sport": 1314, "pgm_dport": 16785, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 57321, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 0, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=0, skb.getLength()=16 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
Thank you
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1> .
Reply to this email directly or view it on GitHubhttps://github.com/steve-o/javapgm/issues/1#issuecomment-37847058 .
Aha, SPM-R should use local_nla - obtained from inspecting local packets, rather than nla which is the address advertised.
On Mon, Mar 17, 2014 at 3:28 PM, viorelstolea [email protected]:
Thanks for replying. I changed the 'pull' to 'reserve' in SourcePathMessageRequest.create()
Now I still get the NullPointerException:
message received->Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 0, "header": { "pgm_sport": 1314, "pgm_dport": 55952, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 18154, "pgm_gsi": "238.246.220.58.2.49",
"pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=16, skb.getLength()=0
Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
This happens here in Socket.java:
/* Send unicast SPMR with regular TTL */ try { pkt.setAddress(peer.getNetworkLayerAddress()); this.send_sock.send(pkt); } catch (java.io.IOException e) { LOG.error(e.toString()); return false; }
because peer.getNetworkLayerAddress() returns null.
in Peer.java:
public InetAddress getNetworkLayerAddress() { return this.nla; }
this.nla is null!
Thanks again!
On Mon, Mar 17, 2014 at 1:47 PM, Steven McCoy <[email protected]
wrote:
Following the other packets types I think the call is supposed to be reserve() not pull().
On Tue, Mar 11, 2014 at 1:55 PM, viorelstolea <[email protected]
wrote:
This code is from Socket.java sendSpmr(Peer peer) ... SocketBuffer skb = SourcePathMessageRequest.create(); after this call skb len is -16
when later trying to create the datagram
DatagramPacket pkt = new DatagramPacket(skb.getRawBytes(), skb.getDataOffset(), skb.getLength(), null, this.udpEncapsulationMulticastPort);
I get illegal length or offset (see below)...
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": -16, "header": { "pgm_sport": 1314, "pgm_dport": 26230, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 47876, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 0, "end": 16, "length": 16 } } Exception in thread "Thread-2" skb.getDataOffset()=16, skb.getLength()=-16 java.lang.IllegalArgumentException: illegal length or offset at java.net.DatagramPacket.setData(DatagramPacket.java:264) at java.net.DatagramPacket.(DatagramPacket.java:116) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2119) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
If I fix the code above, I get into another issue: peer.getNetworkLayerAddress() returns null (is not set) and after setting it to null with the statement below pkt.setAddress(peer.getNetworkLayerAddress());
I get the exception below.
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 16, "header": { "pgm_sport": 1314, "pgm_dport": 16785, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 57321, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 0, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=0, skb.getLength()=16 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
Thank you
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1> .
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1#issuecomment-37847058>
.
Reply to this email directly or view it on GitHubhttps://github.com/steve-o/javapgm/issues/1#issuecomment-37859396 .
For reference, the C implementation handling of SPM-R:
https://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/receiver.c#980
On Mon, Mar 17, 2014 at 3:43 PM, Steven McCoy [email protected] wrote:
Aha, SPM-R should use local_nla - obtained from inspecting local packets, rather than nla which is the address advertised.
On Mon, Mar 17, 2014 at 3:28 PM, viorelstolea [email protected]:
Thanks for replying. I changed the 'pull' to 'reserve' in SourcePathMessageRequest.create()
Now I still get the NullPointerException:
message received->Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 0, "header": { "pgm_sport": 1314, "pgm_dport": 55952, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 18154, "pgm_gsi": "238.246.220.58.2.49",
"pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=16, skb.getLength()=0
Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
This happens here in Socket.java:
/* Send unicast SPMR with regular TTL */ try { pkt.setAddress(peer.getNetworkLayerAddress()); this.send_sock.send(pkt); } catch (java.io.IOException e) { LOG.error(e.toString()); return false; }
because peer.getNetworkLayerAddress() returns null.
in Peer.java:
public InetAddress getNetworkLayerAddress() { return this.nla; }
this.nla is null!
Thanks again!
On Mon, Mar 17, 2014 at 1:47 PM, Steven McCoy <[email protected]
wrote:
Following the other packets types I think the call is supposed to be reserve() not pull().
On Tue, Mar 11, 2014 at 1:55 PM, viorelstolea <[email protected]
wrote:
This code is from Socket.java sendSpmr(Peer peer) ... SocketBuffer skb = SourcePathMessageRequest.create(); after this call skb len is -16
when later trying to create the datagram
DatagramPacket pkt = new DatagramPacket(skb.getRawBytes(), skb.getDataOffset(), skb.getLength(), null, this.udpEncapsulationMulticastPort);
I get illegal length or offset (see below)...
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": -16, "header": { "pgm_sport": 1314, "pgm_dport": 26230, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 47876, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 0, "end": 16, "length": 16 } } Exception in thread "Thread-2" skb.getDataOffset()=16, skb.getLength()=-16 java.lang.IllegalArgumentException: illegal length or offset at java.net.DatagramPacket.setData(DatagramPacket.java:264) at java.net.DatagramPacket.(DatagramPacket.java:116) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2119) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
If I fix the code above, I get into another issue: peer.getNetworkLayerAddress() returns null (is not set) and after setting it to null with the statement below pkt.setAddress(peer.getNetworkLayerAddress());
I get the exception below.
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 16, "header": { "pgm_sport": 1314, "pgm_dport": 16785, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 57321, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 0, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=0, skb.getLength()=16 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
Thank you
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1> .
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1#issuecomment-37847058>
.
Reply to this email directly or view it on GitHubhttps://github.com/steve-o/javapgm/issues/1#issuecomment-37859396 .
Aha indeed! :) Thanks
On Mon, Mar 17, 2014 at 3:44 PM, Steven McCoy [email protected]:
For reference, the C implementation handling of SPM-R:
https://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/receiver.c#980
On Mon, Mar 17, 2014 at 3:43 PM, Steven McCoy [email protected] wrote:
Aha, SPM-R should use local_nla - obtained from inspecting local packets, rather than nla which is the address advertised.
On Mon, Mar 17, 2014 at 3:28 PM, viorelstolea <[email protected] wrote:
Thanks for replying. I changed the 'pull' to 'reserve' in SourcePathMessageRequest.create()
Now I still get the NullPointerException:
message received->Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 0, "header": { "pgm_sport": 1314, "pgm_dport": 55952, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 18154, "pgm_gsi": "238.246.220.58.2.49",
"pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=16, skb.getLength()=0
Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
This happens here in Socket.java:
/* Send unicast SPMR with regular TTL */ try { pkt.setAddress(peer.getNetworkLayerAddress()); this.send_sock.send(pkt); } catch (java.io.IOException e) { LOG.error(e.toString()); return false; }
because peer.getNetworkLayerAddress() returns null.
in Peer.java:
public InetAddress getNetworkLayerAddress() { return this.nla; }
this.nla is null!
Thanks again!
On Mon, Mar 17, 2014 at 1:47 PM, Steven McCoy <[email protected]
wrote:
Following the other packets types I think the call is supposed to be reserve() not pull().
On Tue, Mar 11, 2014 at 1:55 PM, viorelstolea < [email protected]
wrote:
This code is from Socket.java sendSpmr(Peer peer) ... SocketBuffer skb = SourcePathMessageRequest.create(); after this call skb len is -16
when later trying to create the datagram
DatagramPacket pkt = new DatagramPacket(skb.getRawBytes(), skb.getDataOffset(), skb.getLength(), null, this.udpEncapsulationMulticastPort);
I get illegal length or offset (see below)...
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": -16, "header": { "pgm_sport": 1314, "pgm_dport": 26230, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 47876, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 16, "tail": 0, "end": 16, "length": 16 } } Exception in thread "Thread-2" skb.getDataOffset()=16, skb.getLength()=-16 java.lang.IllegalArgumentException: illegal length or offset at java.net.DatagramPacket.setData(DatagramPacket.java:264) at java.net.DatagramPacket.(DatagramPacket.java:116) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2119) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
If I fix the code above, I get into another issue: peer.getNetworkLayerAddress() returns null (is not set) and after setting it to null with the statement below pkt.setAddress(peer.getNetworkLayerAddress());
I get the exception below.
Hello World skb= { "timestamp": 0, "tsi": "null", "sequence": null, "len": 16, "header": { "pgm_sport": 1314, "pgm_dport": 16785, "pgm_type": "PGM_SPMR", "pgm_options": "", "pgm_checksum": 57321, "pgm_gsi": "238.246.220.58.2.49", "pgm_tsdu_length": 0 }, "odata": null, "opt_fragment": null, "buf": { "head": 0, "data": 0, "tail": 16, "end": 16, "length": 16 } } skb.getDataOffset()=0, skb.getLength()=16 Exception in thread "Thread-2" java.lang.NullPointerException: null address || null buffer at java.net.TwoStacksPlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at hk.miru.javapgm.Socket.sendSpmr(Socket.java:2135) at hk.miru.javapgm.Socket.checkPeerState(Socket.java:1735) at hk.miru.javapgm.Socket.timerDispatch(Socket.java:1647) at hk.miru.javapgm.Socket.receive(Socket.java:1029) at com.peltech.ea.PGMTransport$ReaderThread.run(PGMTransport.java:183) at java.lang.Thread.run(Thread.java:722)
Thank you
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1> .
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1#issuecomment-37847058>
.
Reply to this email directly or view it on GitHub< https://github.com/steve-o/javapgm/issues/1#issuecomment-37859396> .
Reply to this email directly or view it on GitHubhttps://github.com/steve-o/javapgm/issues/1#issuecomment-37861121 .