How can I ignore server response to save bandwidth?

I use a server to send some information to another server every second. The problem is that the response of the other server is several kilobytes, and this consumes the bandwidth on the first server (about 2 GB per hour). I would like to send a request and ignore the refund (not even get it to save bandwidth).
For this task, I am using a small python script using (urllib). I do not mind using any other tool, or even any other language, if only the request makes it.

+3
source share
3 answers

The 5K answer is a bit of material and probably below the standard TCP window size of your OS. This means that even if you close your network connection immediately after sending the request and check only the first bytes of the response (to make sure that the request is really received), the server probably already sent you the whole answer, and the packets are already on the wire or on your computer.

If you cannot control (i.e. crop) what the server response is for your notification, the only alternative I can think of is to add another server to the remote machine, waiting for a simple command, and executing the real request locally and just sending back to you result code. This can be done very easily, even with bash / perl / python, using, for example, netcat / wget locally.

, - , .

+3

HTTP HEAD GET POST:

import urllib2

request = urllib2.Request('https://stackoverflow.com/q/5049244/')
request.get_method = lambda: 'HEAD' # override get_method
response = urllib2.urlopen(request) # make request
print response.code, response.url

200 https://stackoverflow.com/questions/5049244/how-can-i-ignore-server-response-t
o-save-bandwidth

. HTTP- HEAD Python?

+2

Sorry, this doesn’t make much sense and is probably a violation of the HTTP protocol. I consider such an idea as strange and broken in design. Either make the remote server shut up or configure the application or something that runs on the remote server at a different protocol level using a more intelligent protocol with less bandwidth usage. Everything else is difficult to consider nonsense.

+1
source

Source: https://habr.com/ru/post/1793204/


All Articles