streaminsight - network data source - push manner

305 views Asked by At

I want to implement an Input Adapter in a StreamInsight app, that gets events from the network, given ip:port (more details here: http://social.technet.microsoft.com/Forums/en-US/streaminsight/thread/e7bcc2c4-45b8-4225-836a-102fd3be437b). The samples I read all work in a pull manner, whereas my scenario would require a push approach. Do you know of such a sample? Or could you give any suggestions? Network programming is not my field, but I can quickly learn, if I know where to start.

Thanks

1

There are 1 answers

0
TXPower275 On

Yes, you can have an input adapter that allows data/events to be pushed to it via TCP. Take a look at using the TCPListener class. Here's the link to MSDN: http://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx

When Start() is called on your input adapter, you'll need to instantiate an instance of the TCPListener and start accepting connections. In your "listening loop", you'll need to handle the NetworkStream and deserialze the incoming data and convert it to events to be enqueued into the StreamInsight query engine. You will also need to implement Stop() to stop accepting connections. Don't forget to Dispose() any resources you've created in the process.

Hope this helps.