IO HTTP Image Download
The task is to download an image from www.adaptive-vision.com using TCP IP connection.
A hostname of website to connect to.
The downloaded image messe.jpg and information about it.
To download the messe.jpg image from www.adaptive-vision.com you need to send the following query string through connected TCP socket: GET /site_media/native/content/messe.jpg HTTP/1.0. The task can be easily solved using filters from the TCP IP category and LoadImageFromBuffer filter.
Enable sections by clicking on the Show Sections () button.
- Add TcpIp_Connect filter to connects as a client to server socket.
- Add TcpIp_WriteText filter to send query string and header through a connected TCP socket.
- Add TcpIp_ReadLine filter to read response headers and connect it with output of TcpIp_Connect filter.
- Add TcpIp_ReadAllBuffer to receive data from a connected socket. Set inTimeout to 2000.
- To convert received data from a ByteBuffer type to an Image type add LoadImageFromBuffer filter and connect its input inBuffer to output of TcpIp_ReadAllBuffer filter.
- To close socket add TcpIp_Close filter.
|TcpIp_Close||Close a connected TCP socket gracefully.|
|TcpIp_Connect||Connects as a client to a remote TCP server socket.|
|TcpIp_ReadAllBuffer||Receives data from a connected socket until the other side closes connection.|
|TcpIp_WriteText||Outputs a string through a connected TCP socket.|
|TcpIp_ReadLine||Reads from a connected TCP socket until receiving a specific sequence.|
|LoadImageFromBuffer||Use this filter when you received an image file through I/O communication, e.g. through a TcpIp connection.|
- TCP/IP Networking - Detailed information about using TCP/IP filters.