how to read data that is written from a communication Port?
<p>I try to make communication between my device and python code via COM4 a communication port:  pyserial communication.
So at first I try to send and write a hello then to read the output of my device, 
But the problem for me is how to read the hello that is sent firstly. I mean that I want to read the string  hello on COM4 from my device</p>

<pre><code> import serial
    ser = serial.Serial(
        port='COM4',\
        baudrate= 230400)  # open serial port
    print(ser.name)         # check which port was really used
    #ser.write(b'hello\n')     # write a string
    #str=ser.readline()
    while True:
        print(ser.read(30).decode())
    ser.close()             # close ports
</code></pre>

<p>The code of my device is written in C language.</p>

<p>I would be very grateful if you could guide me please. </p>