diff -ur v1/sock_ut.py v2/sock_ut.py --- v1/sock_ut.py 2021-06-09 16:10:05.000000000 +0900 +++ v2/sock_ut.py 2021-06-10 21:09:48.000000000 +0900 @@ -17,26 +17,32 @@ return None return cs -def send_str( sc, s ): - bt = s.encode( 'utf-8' ) +def send_bt( sc, bt ): try: sc.sendall( bt ) except: return False return True -def recv_str( sc ): +def recv_bt( sc ): bufmax = 16 * 1024 bt = sc.recv( bufmax ) - s = bt.decode( 'utf-8' ) - return s + return bt + +def send_str( sc, s ): + bt = s.encode( 'utf-8' ) + return send_bt( sc, bt ) + +def recv_str( sc ): + bt = recv_bt( sc ) + return bt.decode( 'utf-8' ) def pipe_loop( sc_from, sc_to ): while True: - s = recv_str( sc_from ) - if not s: + bt = recv_bt( sc_from ) + if not bt: break - if not send_str( sc_to, s ): + if not send_bt( sc_to, bt ): break # srv=name