Is it possible to receive OSC data via the ConnectionReader?
I have a C++ program that is not tied into Panda and it sends via OSC. Is there a different way that I can configure the data sending in C++ to be accepted by ConnectionReader?
My data is just an array of floats.
I get this error when I try to read / print raw OSC data from the iterator
- Code: Select all
AssertionError: _current_index + s_len <= _datagram->get_length() at line 30 of panda/src/express/datagramIterator.cxx
- Code: Select all
from panda3d.core import QueuedConnectionManager, QueuedConnectionListener, QueuedConnectionReader, ConnectionWriter, PointerToConnection, NetAddress, NetDatagram
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator
from direct.directbase.DirectStart import *
class SN:
def __init__(self):
self.cManager = QueuedConnectionManager()
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cReader.setRawMode(True)
#self.cWriter = ConnectionWriter(self.cManager,0)
self.port_address=7000
self.udpSocket = self.cManager.openUDPConnection(self.port_address)
self.cReader.addConnection(self.udpSocket)
taskMgr.add(self.tskReaderPolling,"Poll the connection reader",-40)
def tskReaderPolling(self, taskdata):
if self.cReader.dataAvailable():
datagram=NetDatagram() # catch the incoming data in this instance
# Check the return value; if we were threaded, someone else could have
# snagged this data before we did
if self.cReader.getData(datagram):
self.myProcessDataFunction(datagram)
return taskdata.cont
def myProcessDataFunction(self, netDatagram):
myIterator = PyDatagramIterator(netDatagram)
msgID = myIterator.getUint8()
#if msgID == PRINT_MESSAGE:
messageToPrint = myIterator.getString() ### this causes the above error
print messageToPrint
sn = SN()
run()
