PDA

Click to See Complete Forum and Search --> : how to stop and start a UDP stream?


Stile
Apr 30th, 2007, 04:05 AM
I have an app that reads an incoming data stream from a UDP port. The datastream is in the form of a single string, with line separators. I simply need to read the last line of the string, in order to get the latest data.

However, as the string continues to build, it takes longer to get to the last line, since the size of the stream is increasing continously. What I want to be able to do is stop the incoming stream, and then restart it, every 5 minutes or so. What this would do is, it would restart the stream fresh after each restart.

What are my options for this? What command can i use to stop/restart an incoming UDP stream? Obviously i want the interruption to be as small as possible, since i dont want to miss data. Any ideas?

DigiRev
Apr 30th, 2007, 05:15 AM
What are you receiving the UDP stream from? A program you made? Another program?

Stile
Apr 30th, 2007, 05:58 AM
Im receiving the stream from a stock trading application. The application sends a UDP stream of the latest price quotes.

I want to be able to read the last line of the stream, since that contains the latest quotes, and then post it to a text file. But then i want to stop the stream and restart it every 5 minutes, in order to keep the size of the stream in check.

DigiRev
Apr 30th, 2007, 06:46 AM
Do you have any control of where the stream starts? Or does it always start from the beginning?

I've only made a couple UDP programs, everything else I do is TCP/IP.

Are you using Visual Basic 6 or .NET? Winsock control? API?

In VB6 with Winsock you can just close the socket and I think that will stop the stream, even though there is no real 'connection' made since it's UDP.

Then after 5 minutes send another request for the stream.