Hi @Naterlarsen somehow i don't know why i am writing... In the last trheads 
you worked on a client server tool. And it seems to work... This code has 
errors in the basic handling of the sockets...
    
    
    let (client_socket, _) = server.accept()
    
    
    Run

Is this even nim? You know how to do it right...

To get you going here is a code snippet which will fit into your existing 
programm. the filedata will get base64 encoded it's a bit of overhead... but it 
won't interfer with the readlines in your client...
    
    
    import std/base64
    ...
    elif input.startsWith("download"):
    ...
      try:
        var bytes = readFile(my_path)
        let encoded = encode(bytes)
        client.send(encoded & "\n")
      except:
        client.send("file not found \n")
    ...
    
    
    Run

Reply via email to