sightmachine/SimpleCV — pull request #619 by rvraghav93 (2014-02-23 18:13:54+00:00)
Title: Added Support for automatic port change when image is streamed to browser.

When using browser display by calling `img.show(type="browser")` a JpegStreamer server is opened at a fixed port number of 8080. When this port is used by another server, an error is raised to reflect the fact that the port is already in use.

`[Errno 98] Address already in use`

To Replicate:

```
ipython notebook --port=8080
simplecv
>>> i = Image('lenna')
>>> i.show(type = 'browser')
```

Fix:
The streamer is switched to adjacent port if the current port is busy. [ ipython like behaviour]

Implementation:
A global variable `_port` holds the current port number ( at start - 8080 )
Using try except block the exception is caught, the port number is incremented ( till port 8090 max ) and streamer initialization is tried again from the current port.

-repo has been pulled from sksavant's fork to build upon the bug fix #617 [ commit #169e090 ] since both these issues are related.