Stream Server Question ( Technical )

Questions? Suggestions? Need help? Talk about anything related to Yawcam...
Post Reply
petethered
Posts: 6
Joined: Tue Oct 19, 2004 2:08 am

Stream Server Question ( Technical )

Post by petethered »

Ok,

I am working on a relay/reflector for a YawCam stream and ran into a little problem.

As best I can tell, the applet passes in

streamReq\r\n

And is returned

ok

( Or possibly "2many" )

Then it passes in a single byte to the server. Here is where I run into the problem

new byte b = 64;

Then it gets returned an int with the size, continues reading in bytes till the size is reached then draws image and loops back after a delay.

Am I correct so far?

It's the single byte that gets passed in that confuses me.

What exactly is it passing in?

PeteTheRed
malun
Site Admin
Posts: 1590
Joined: Sun Jan 04, 2004 1:29 pm

Post by malun »

This byte is just a way for the applet to tell the Yawcam application that it wants more image data. If Yawcam doesn't get this byte it will close the TCP connection after a while. 64 is just a number made up by me.
My thoughts were to make the system easy to expand, so this number should be possible to replace to request something different from the Yawcam application sometime when new functions are available.

Good Luck!
/Magnus Lundvall
petethered
Posts: 6
Joined: Tue Oct 19, 2004 2:08 am

Post by petethered »

Ok,

I figured that part out. It was easy enough to tell the truth, I just wanted to make sure there was no significance to it other then a "I'm ready for an image" notification.

Now, the next step as far as I can tell is that it reads in an integer value via readInt.
readInt
public final int readInt()
throws IOExceptionSee the general contract of the readInt method of DataInput.
Bytes for this operation are read from the contained input stream.


Specified by:
readInt in interface DataInput
Returns:
the next four bytes of this input stream, interpreted as an int.
Throws:
EOFException - if this input stream reaches the end before reading four bytes.
IOException - if an I/O error occurs.
See Also:
FilterInputStream.in


Am I Right so far? The Next 4 bytes passed back AFTER the [EDIT] "ok\r\n"; [/EDIT] are then parsed as an int to represent the filesize of the frame.

Then an array of bytes is made and read into until the size is reached.

Now the problem I'm running into is that for the life of me, I can not get it to parse the Int. I'm crafting the relay in perl, and converting the formats is not working.

Any ideas? Is the image terminated in any way?
petethered
Posts: 6
Joined: Tue Oct 19, 2004 2:08 am

Post by petethered »

Wahooo! got it.... It was a problem with my method of converting the bytes to an integer....

Hehehe..... Nifty .... capturing frames from the stream right now
malun
Site Admin
Posts: 1590
Joined: Sun Jan 04, 2004 1:29 pm

Post by malun »

Nice!
So, are you planning to share your work to all yawcam users out there?

/malun
petethered
Posts: 6
Joined: Tue Oct 19, 2004 2:08 am

Post by petethered »

Yup... atleast the proof of concept.

http://www.yawcam.com/forum/viewtopic.php?p=483
Post Reply