Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Python TCP socket send String

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
Oct 7, 2021 at 12:12 history edited Community Bot
replaced https://tools.ietf.org/html/rfc with https://www.rfc-editor.org/rfc/rfc
Oct 16, 2020 at 18:27 comment added felipe @PresidentJamesK.Polk You are completely right. I originally wrote the answer with the intention to redirect OP towards abstracting out of sockets - not very good in my part. I've expanded my answer to include the CRLF. A quick note on your response, your request is missing the ending CRLF that most server would require to conclude the message is valid - minor, I know, but worth noting in case OP has some fickly servers never responding.
Oct 16, 2020 at 18:25 history edited felipe CC BY-SA 4.0
added 1369 characters in body
Oct 16, 2020 at 14:47 comment added President James K. Polk Many http servers will accept invalid HTTP, so for example something as simple as s.send(b'GET\r\n') may work.
Oct 16, 2020 at 14:42 comment added President James K. Polk @0brine: This answer shows a minimal correct string to send, however, each "newline" needs to be a carriage-return linefeed pair, e.g. b'\r\n'. Thus s.sendall(b'GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\nAccept: */*\r\n') should suffice.
Oct 16, 2020 at 14:37 comment added 0brine no, i want to use a TCP connection because i also want to check other services like, smtp, imap, pop, ssh, ...
Oct 16, 2020 at 9:38 history answered felipe CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /