0

I am working on a server (NanoHTTPD) in Java, which publishes an image. The image is then intended to be loaded into MS Word, where is already an Image object, which gets reloaded by hitting F9.

It is working fine, although for some reason, Word loads the image twice on single refresh. That gives me two entries in user log on server side. Of course, it is a tiny detail, but I don't like to just hide the second log in a hacky way.

I tried to make server add "connection: close" header, but, according to WireShark, Word then just uses two requests insead of one session.

Any reason for this behavior?

EDIT:

As seen from WireShark:

GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 13:20:30 GMT Connection: keep-alive Content-Length: 79167 (transfer of PNG) GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 13:20:30 GMT Connection: keep-alive Content-Length: 79167 (transfer of PNG)

After server closing connection:

GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 15:41:06 GMT Connection: close Content-Length: 23434 (transfer of PNG) GET / HTTP/1.1 Accept: */* User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; MASBJS; ms-office; MSOffice 16) Accept-Encoding: gzip, deflate Host: 192.168.43.1:5326 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/png Date: Mon, 6 Aug 2018 15:41:06 GMT Connection: close Content-Length: 23434 (transfer of PNG)

  • Could you add to your post these two requests? – harrymc Aug 6 '18 at 14:36
  • Added the requests. Basically, only Connection in reply from server changes. The Content-Length varies, because I teested it with different images. And WireShark handles them as a separate streams. – axon Aug 6 '18 at 15:55
  • Maybe connected: In File > Options > Advanced > General section (scroll down), the option "Update Automatic Links at Open" does "automatically update both fields and links". If I understand right, your image is both a field and a link, so perhaps this is why it's refreshed twice. Try to uncheck this option and click OK. – harrymc Aug 6 '18 at 16:23
  • Thanks! It led me to options next to URL field in open dialog. I selected Attach to file and it seems the file gets downloaded only once. If you post your comment as an answer, i'd accept it. – axon Aug 8 '18 at 5:13
0

Maybe connected:

In File > Options > Advanced > General section (scroll down), the option "Update Automatic Links at Open" does "automatically update both fields and links".

If I understand right, your image is both a field and a link, so perhaps this is why it's refreshed twice. Try to uncheck this option and click OK.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.