WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Streaming data with onNetwork (https://forum.worldviz.com/showthread.php?t=4587)

Ryan 05-15-2013 02:29 PM

Streaming data with onNetwork
 
I'm following the example shown here to get MatLab to stream data to Vizard:

http://docs.worldviz.com/vizard/Networking_Basics.htm

def onNetwork(e):
print '** Received message from',e.sender
print e.data #Prints: (5, 'hello', [1, 2, 3])
...

I know that I've successfully gotten some communication working, but when I run my MatLab program that sends the data, an error message appears in Vizard, instead of the data that I'm expecting. The error is:

Traceback (most recent call last):
File "file name", line 300, in onNetwork
print e.data
AttributeError: 'RawNetworkEvent' object has no attribute 'data'

I am able to transfer data from another Vizard script (using the other example from the Networking_Basics web site), so it seems that the problem has to do with streaming from other applications.

It seems there possibly is no e.data attribute when streaming information from other apps. Is there another way to address the information being sent other than e.data?

Thanks in advance.

farshizzo 05-15-2013 03:07 PM

When receiving data from a non-Vizard app, you can access the raw data using e.raw_data. The documentation mentions this. The raw_data attribute will be a string that contains the raw byte data from the UDP packet.

Ryan 05-16-2013 06:47 AM

Thanks. Not sure how I missed that.


All times are GMT -7. The time now is 12:00 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC