title: How to stop Spark Streaming context when the network connection (TCP IP) is closed?
body: <p>In other words Instead of setting 'duration' in Spark streaming context to a value, I want to set it to (socket close time - socket open time)</p>