Program:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = '101.72.14.20'
port = 23
s.connect((host, port))
tm = s.recv(1024)
s.close()
print("The time got from the server is %s" % tm.decode('ascii'))
Error:
$ python cli.py
Traceback (most recent call last):
File "cli.py", line 20, in <module>
print("The time got from the server is %s" % tm.decode('ascii'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)
$
It is a simple client program. I tried to read the content from server. It successfully reads. But it shows an error while printing as "UnicodeDecodeError". Can anyone help me to solve this problem.
Note:
101.72.14.20 is a mainframe server. I expect the data is in the form of EBCDIC