0

Should data be sent all at once, or one by one in the WHOIS protocol?

So, when I create a whois server, should I do this:

Client sends "example.tld" to server
Server sends "Some info about example.tld" to the client
Server sends "Some more info about example.tld" to the client
Server sends "Remaining info about example.tld" to the client

CONNECTION CLOSED

OR:

Client sends "example.tld" to server
Server sends "All info about example.tld at once" to the client

CONNECTION CLOSED

So for Python, should I do socket.send(bytes("info about that domain requested\r\n", encoding="UTF-8")) for each line? Or should I do it for all of the lines at once, i.e., socket.send(bytes("all info about that domain\r\nthat was requested", encoding="UTF-8"))

  • I'm not clear what the difference is. Won't the stream of data on the network connection be exactly the same in both cases? Are you asking if there's some kind of pause or acknowledgement after each section? – IMSoP Mar 30 '21 at 11:06
  • @IMSoP, I mean, should I send the data line by line, i.e., re-running `socket.send` for every line? Or prepare the whole thing, and send it all at once? – WebTestingRL Mar 30 '21 at 11:08
  • How would the other end of the connection tell the difference? It's like the difference between `print "foo"; print "bar";` and `print "foobar";` - the result is identical. – IMSoP Mar 30 '21 at 11:09
  • @IMSoP result is the same, but I need to make sure I follow Internet standards – WebTestingRL Mar 30 '21 at 11:10
  • @IMSoP, what I am asking is, is there a rule that says that you must do `print "foo"; print "bar";` or `print "foobar";` in the WHOIS protocol rules. – WebTestingRL Mar 30 '21 at 11:12
  • The protocol doesn't define how you write your code, it defines _what the result looks like_. For the protocol to define which version is correct, there would have to be a way to tell the difference between them, without inspecting your source code. If there's no difference, the question is meaningless. – IMSoP Mar 30 '21 at 12:21

0 Answers0