1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] I wrote a simple python website with socket but no output either an error?

Discussão em 'Python' iniciado por Stack, Setembro 14, 2021.

  1. Stack

    Stack Membro Participativo

    I was watching a video about python and I wanted to try the code and that was after i make it for HTTP1.1:


    import socket
    call = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    call.connect(('data.pr4e.org', 80))
    req= 'GET /romeo.txt HTTP/1.1\r\nHost: http://data.pr4e.org'. encode() #(method, url, body=None, headers={})
    call.send(req)

    while True:
    txt = call.recv(512)
    if (len(txt) < 1) :
    break
    print (txt.decode())
    call.close()


    but when i run this code i get no output

    Continue reading...

Compartilhe esta Página