Python 3 Sockets - Receiving more then 1 character
<p>So when I open up the CMD and create a telnet connection with:</p>

<p>telnet localhost 5555</p>

<p>It will apear a "Welcome", as you can see on the screen below.
After that every single character I type into the CMD will be printed out/send immediately.
My Question is: Is it, and if yes, how is it possible to type in messages and then send them so I receive them as 1 sentence and not char by char.
<a href="http://i.stack.imgur.com/kexib.png" rel="nofollow"><img src="http://i.stack.imgur.com/kexib.png" alt="enter image description here"></a></p>

<pre><code>import socket
import sys
from _thread import *

host = ""
port = 5555
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

try:
    s.bind((host,port))
except socket.error as e:
    print(str(e))

s.listen(5) #Enable a server to accept connections.
print("Waiting for a connection...")

def threaded_client(conn):
    conn.send(str.encode("Welcome\n"))

    while True:
    # for m in range (0,20): #Disconnects after x chars
        data = conn.recv(2048) #Receive data from the socket.
        reply = "Server output: "+ data.decode("utf-8")
        print(data)
        if not data:
            break
        conn.sendall(str.encode(reply))
    conn.close()

while True:
    conn, addr = s.accept()
    print("connected to: "+addr[0]+":"+str(addr[1]))
    start_new_thread(threaded_client,(conn,))
</code></pre>

<p>It depends if you want to run on character mode or line mode.
Presently your code is fine, but your windows telnet client runs in character mode. You could use putty to give it a try in line mode, or if you really need to run in char mode, then keep reading the buffer until a newline is sent. </p>

<p>Here is what the server says when I run your code :</p>

<pre><code>Waiting for a connection...
connected to: 127.0.0.1:46738
b'Hello\r\n'
</code></pre>

<p>the telnet session beeing :</p>

<pre><code>telnet 127.0.0.1 5555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Welcome
Hello
Server output: Hello
</code></pre>

python sockets python-3.x