2 of 9
2
TUIO tcp proxy
Posted: 25 May 2008 02:51 PM   [ Ignore ]   [ # 16 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

As I wrote you in pvt, just to repeat here so if someone else is trying to make it work.
My implementation (in tuio_sdump.exe) is making fresh connection after
each received data transfer as the socket is closed after the data is sent.
This is due to using nonblocking tcp server architecture, I tried first to reuse the current
connection, but that failed as the client stopped receiving the data (similarly to your issue now)
So maybe It’s possible to do that in similar way in flash.
(create new connection after receiving one message)
Anyway we are doing good progress, and this eventually will work (hopefully better than flosc)

Profile
 
 
Posted: 25 May 2008 06:44 PM   [ Ignore ]   [ # 17 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

I can make another connection after the connection is closed but I was unsure as to whether I could be losing packets this way. I’ll look more into it anyway.

EDIT: I’ve tested eveything and it appears that I am losing packets. I very rarely get any alive packets with id’s, or any fseq packets, which means I can’t properly update blobs in flash :( Seams that flash can’t connect to the socket fast enough after it has lost connection. Any ideas?

As for the parsing, would it be possible to simply transfer the raw binary data from the udp packets as it is? This way the numbers can stay as 32 bit integers and floats etc as in the TUIO spec, and I can parse the binary data quickly and efficiently. This is as opposed to receiving a string and using string methods to separate it by commas, which I’m pretty sure will take up more processing time than using the binary methods.

We’re getting there! great work so far!

Profile
 
 
Posted: 26 May 2008 02:36 AM   [ Ignore ]   [ # 18 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

Hm ok, I’ll see what I can do today. I’ll try again to reuse the connection in some way, and to forward the data as it is.

Profile
 
 
Posted: 26 May 2008 01:49 PM   [ Ignore ]   [ # 19 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

Ok I think I’m almost there, I’ve rewrited the socket handling, so now it doesn’t close the connection (I tried with your swf and it’s continuing to recieve the data)
still have to find few bugs (you need to restart the proxy after each closed connection, on linux it closes it self even .. so that’s something I must repair)
And the data now is sent in almost original tuio format ( I used the liblo format as it seems maybe easier to parse), data is sent as structs so I guess now depends
on how it’s doable with flash (this kind of things are easy to implement in every scripting language I know).
So this is the format:
typedef struct
{
char path[11];
char name[5];
char *types;
int blobs[50];
} alive;
example:
path = /tuio/2Dcur
name = alive
types = ssiii ( i x num of blobs)
blobs = 1 2 3…

typedef struct
{
char path[11];
char name[3];
char *types;
int sessionID;
float x,y,X,Y,m,w,h;
} set;
example:
path = /tuio/2Dcur
name = set
types = ssifffffff
sessionID = 1 (the blob processed)
x,y… = 0.1 0.1…

typedef struct
{
char path[11];
char name[4];
int framenum;
} fseq;

so the types defines what is at which position (s=string, i= int, f =float) and how many values are there.
anyway here is updated exe (still bugy, but this way you can try and see how it’s doing)
[edit]
About forwarding *raw data, well that’s quite difficult as the liblo (which I’m using to parse tuio) is breaking it and parsing without
offering the possibility of raw packet reading. As a side note I found a bug in liblo (which is already reported), that even further complicate
parsing the “raw” data. So I’m leaved with manually formating the message to parse with looping trough the values more or less.

Profile
 
 
Posted: 26 May 2008 03:24 PM   [ Ignore ]   [ # 20 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

The format of the packets should be perfect now thanks, but the app keeps crashing a few seconds after launch. If I start it before I start osc.exe it’s fine, but when I start osc.exe and once the blobs start being sent the app crashes. I think it has something to do with the set packets. Still, great work so far!

Profile
 
 
Posted: 26 May 2008 05:15 PM   [ Ignore ]   [ # 21 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

hmm so if I understood you right, everything works fine when you start app and then osc, but when you R starting the app prior to the osc the app crashes after some time ? I have some crashes my self, and I’m trying to see where is the cause,
I believe thats happening because I don’t check for connection once the connection is established (after that I just loop and send recieved data).. anyway it’s to soon to say as I just started to look at that ( I was repairing connection closing)
any feedback is welcomed.

Profile
 
 
Posted: 26 May 2008 05:19 PM   [ Ignore ]   [ # 22 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

I’m pretty sure the app crashes around the time set packets are sent. If I start osc first I can start the app when there are no blobs, but as soon as I touch the screen the app crashes. If I start the app first and then osc, again everything is fine until I touch the screen.

Profile
 
 
Posted: 26 May 2008 05:25 PM   [ Ignore ]   [ # 23 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

hm so you actually don’t receive any data ? That’s strange as I’m getting the feed with your swf (exe running under wine). But it is crashing the proxy after the exiting.. after that I must restart it to regain the feed.

Profile
 
 
Posted: 26 May 2008 05:27 PM   [ Ignore ]   [ # 24 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

I receive empty alive and fseq packets into flash but no set packets as the app crashes when I touch the screen. Hmmm

Profile
 
 
Posted: 26 May 2008 05:30 PM   [ Ignore ]   [ # 25 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

ok I’ll look into that tomorrow .. I’m going to bed right now
Tomorrow is the release day (I hope) smile
[edit]
I think I fixed the set msg issue you had,I guess you use touchlib to debug, when I’m using tuio simulator
that’s why I didn’t see that error before.I still need to fix sigpipe, on windows app
doesn’t stop after client closes the connection as windows doesn’t have signals, but on linux we have sigpipe
and EPIPE and that’s why the proxy exits. I suspected that was the problem, now I must find a way to
re initiate the connection after client disconnet’s. ( for now you must restart the proxy)
Here Is updated exe. About you’re receiving empty msgs, well they aren’t empty .. they are just
packed in a C manner, and I’m not sure if flash can extract it (it is possible with doing some byte magic)
for example C sends string with \ 0 terminated string (that signals the end of char array). You can check that
with old tuio_sdump.exe (it wont print anything meaningful as it’s expecting the string buf)

Profile
 
 
Posted: 27 May 2008 07:21 AM   [ Ignore ]   [ # 26 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

Just a quick update as I won’t be online for a few hours…

Eveything works fine for testing now, so I have just about finished the flash socket implementation, I just have to sort out how the messges are split when flash receives them as flash sometimes receives four of five messages convoluted into one binary stream, but this shouldn’t take long to sort. Anyway it should be all finished at the flash end by tonight (fingers crossed)

Profile
 
 
Posted: 27 May 2008 01:25 PM   [ Ignore ]   [ # 27 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

Hey just wondering how the types in the struct work. I’m trying to parse the binary data and I have successfully parsed the path and name, but I was unsure of the types. Could you clarify? This is the only thing stopping me completing the flash implementation.

PS. hows the app coming? Have you worked out most of the bugs?

Profile
 
 
Posted: 27 May 2008 02:58 PM   [ Ignore ]   [ # 28 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

Well I’m almost there, as for now I’m systematizing the code, it’s in mess right now after changing everything upside down few times.
I’ve implemented now the catching of connection terminated, and I’m looking in how to clear / reset / reinitiate it without the need of
restarting the app.
About the reading the struct from flash.. only thing that cross my mind and it could be explored is python struct module,
http://www.python.org/doc/current/lib/module-struct.html , Its doing just that, uses the byte *magic* reordering
to extract data from the structs. But I’m not sure if it’s worth to go that way, maybe it would be easier to send the data in some other
format. (as example: buffer with everything written as strings)
Just let me know and I’m going to rewrite that part, It’s not that complicated.

Profile
 
 
Posted: 27 May 2008 03:23 PM   [ Ignore ]   [ # 29 ]
Rank
Joined  2007-10-23
Total Posts:  87
New Member

OK this is my status… I have successfully parsed out the frame number from the fseq packets and the active object id’s from the alive packets using binary methods in flash, but I’m struggling with the set packets. I’ll keep working on it though as it seams really fast at the moment. Could you check things in your app’s code around the construction or sending of the set packets just to make sure everything is ok there? I just don’t want to be spending ages trying to figure out what is wrong at the flash end if there isn’t anything. Thanks

Profile
 
 
Posted: 27 May 2008 03:51 PM   [ Ignore ]   [ # 30 ]
Avatar
RankRank
Joined  2008-03-02
Total Posts:  107
Member

Well I just found out that I maybe have an issue there, I’ve added some error checking routine to the sockets, and It could be that the buffer is too small .. I’ll keep you informed
[edit]
It seems that I got the error by my mistake, so actually it looks good for now (without any core changes to last release).
I’m writing now the updated dump client, so I can easily debug the thing.

Profile
 
 
   
2 of 9
2
 
‹‹ MIDI      OSC LIST OF MESSAGES ? ››