回答編集履歴
1
Update
    
        answer	
    CHANGED
    
    | 
         @@ -1,1 +1,1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            [ 
     | 
| 
      
 1 
     | 
    
         
            +
            [pySerial](https://github.com/pyserial/pyserial) パッケージの [protocol_socket.py](https://github.com/pyserial/pyserial/blob/master/serial/urlhandler/protocol_socket.py#L350) が参考になるかもしれません。
         
     |