TCP client and server supporting six simple commands
I would recommend that you read PEP 8, the Python style guide.

PEP 8 says:


  Use 4 spaces per indentation level.


You use four spaces in some places, but in others you use eight.  At the very least you should be consistent, but it is best if you consistently use four spaces.  In fact, looking at your code, your indentation is completely shot.  I spy with my little eye an IndentationError in the elif data.startswith('REQDATE'): block.  Your break statements in those if blocks are not consistent either.


print("sending: " + str(data))



One line up you defined data as a string.  Python objects don't just drift into new types.  They don't change unless you change them.  You don't need the str part here.  Just do this:

print("sending: " + data)


You convert data to a string in several other places, but there also it is useless.  That's like translating a German sentence into English and then translating that sentence into English every time I want to use it.  What is the purpose of translating English into English?


if True:



True is always True, so that if block will always be executed.  Why do you use an if block if you always want to execute what is inside?


if data.startswith('HELO'):
    try:
        c.sendall(...)
    except:
        c.sendall(...)
    break
elif data.startswith('REQTIME'):
    try:
        c.sendall(...)
    except:
        c.sendall(...)
        break
...



You have some duplicate code there.  That is, it would be duplicate if you were consistent with what you wanted.  There are two things that change in these: The string given to the first c.sendall() and the string given to the second c.sendall().  I would create a dictionary:

messages = {
    'HELO': (
        "210 HELO " + host + " This is Dalek High Command.  You will obey all orders without question!",
        "510 You are unauthorized! You will be exterminated!"),
    'REQTIME': (
        "220 I obey!  The time is " + time.strftime("%H%:M%:S"),
        "520 The time is unavailable!  Exterminate!"),
    'REQDATE': (
        "230 I obey!  The date is " + time.strftime("%Y/%m/%d"),
        "530 The date is unavailable!  Exterminate!"),
    'ECHO': (
        "240 Data received! " + data.upper(),
        "540 ECHO!  I cannot obey!  Assist!  Assist!  Cannot comply!  Exterminate!"),
    'REQIP': (
        "250 IP has been identified! " + host,
        "550 Alert!  I cannot obey! Your IP cannot be retrieved!"),
}

for key, value in messages.items():
    if data.startswith(key):
        try:
            c.sendall(value[0])
        except:
            c.sendall(value[1])
        break
else:
    if data.startswith('BYE'):
        try:
            c.sendall ("600 Alonzy! Bowties are cool!  See you later!")
        except:
            break



sys.exit()
c.close()



You exit the program and then expect to be able to close c?  Perhaps that's a debugging call that you forgot to take out, but sys.exit() is unnecessary here.


for x in range(0, 5):
    if x == 0:
        data = 'helo'
        s.send(data)
    elif x == 1: 
        data = 'reqtime'
    elif x == 2:
        data = 'reqdate'
    elif x == 3:    
        data = 'echo'
    elif x == 4:
        data = 'reqid'
    elif x == 5:
        data = 'bye'

s.send(data)
print(str(data))
x = x + 1



I'm guessing that the s.send(data) and below lines were meant to be inside of the for loop.  If they were, there is a much simpler way to do this:

for data in ("helo", "reqtime", "reqdate", "echo", "reqid", "bye"):
    s.send(data)
    print(data)