#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket

HOST = '192.168.50.188'
PORT = 1881
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

while True:
    indata = s.recv(1024)
    if len(indata) == 0:  # connection closed
        s.close()
        print('server closed connection.')
        break
    print('recv: ' + indata.decode())
 #   if indata.decode() == 'FI_Waitting':
  #       print('FI_Waitting')
   #      outdata = input('please input message: ')
         #outdata = [0xff,0x01,0x22,0x53]
    #     print('send: ' + str(outdata))
     #    s.send(str(outdata).encode())
    #if indata.decode() == 'FI_Fermentation':
    #     print('FI_Fermentation')
    #    outdata = input('please input message: ')
         #outdata = [0xff,0x01,0x22,0x53]
      #   print('send: ' + str(outdata))
     #    s.send(str(outdata).encode())
    #if indata.decode() == 'FI_Outputtingbeans':
     #    print('FI_Outputtingbeans')
      #   outdata = input('please input message: ')
         #outdata = [0xff,0x01,0x22,0x53]
       #  print('send: ' + str(outdata))
        # s.send(str(outdata).encode())