Error 102: lost connexion

With this code:

Img_BS.Write Img_Socket.Get(Img_URL, 30) If Img_Socket.LastErrorCode > 0 Then

But the image is downloaded !

Yup. Network sockets are not guaranteed to run to completion. Kinda like if someone were to pull the Ethernet cable or turn off your Wi-Fi mid stream.

You should also look at img_socket.HTTPStatus. It could be that the server is disallowing the download.

Thanks Greg.

What a strange idea to search about an error ! In the case above, I do not have images on Sundays, so I wanted to avoid asking for one [in fact, that is what I think I had in mind; now, I am unsure].

BTW: I use a HTTPSecureSocket

OK: I tested img_socket.HTTPStatus and I get error 200 AND my file.

It may be time for a lunch !

Right. So the HTTPSocket and HTTPSecureSocket will always give you a lastErrorCode if 102 at the end. As an http/1.0 socket, they will always complete with a socket closure, which is what error 102 is.