当前位置: 首页>>代码示例>>Python>>正文


Python ModbusUdpClient.close方法代码示例

本文整理汇总了Python中pymodbus.client.sync.ModbusUdpClient.close方法的典型用法代码示例。如果您正苦于以下问题:Python ModbusUdpClient.close方法的具体用法?Python ModbusUdpClient.close怎么用?Python ModbusUdpClient.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymodbus.client.sync.ModbusUdpClient的用法示例。


在下文中一共展示了ModbusUdpClient.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SynchronousUdpClient

# 需要导入模块: from pymodbus.client.sync import ModbusUdpClient [as 别名]
# 或者: from pymodbus.client.sync.ModbusUdpClient import close [as 别名]
class SynchronousUdpClient(Runner, unittest.TestCase):
    """
    These are the integration tests for the synchronous
    udp client.
    """

    def setUp(self):
        """ Initializes the test environment """
        super(Runner, self).setUp()
        self.client = ModbusClient()

    def tearDown(self):
        """ Cleans up the test environment """
        self.client.close()
        super(Runner, self).tearDown()
开发者ID:ccatterina,项目名称:pymodbus,代码行数:17,代码来源:synchronous_udp_client.py

示例2: AsynchronousUdpClient

# 需要导入模块: from pymodbus.client.sync import ModbusUdpClient [as 别名]
# 或者: from pymodbus.client.sync.ModbusUdpClient import close [as 别名]
class AsynchronousUdpClient(Runner, unittest.TestCase):
    '''
    These are the integration tests for the asynchronous
    udp client.
    '''

    def setUp(self):
        ''' Initializes the test environment '''
        super(Runner, self).setUp()
        self.client = ModbusClient()

    def tearDown(self):
        ''' Cleans up the test environment '''
        self.client.close()
        super(Runner, self).tearDown()
开发者ID:4rc4n4,项目名称:pymodbus,代码行数:17,代码来源:asynchronous-udp-client.py

示例3: testBasicSyncUdpClient

# 需要导入模块: from pymodbus.client.sync import ModbusUdpClient [as 别名]
# 或者: from pymodbus.client.sync.ModbusUdpClient import close [as 别名]
    def testBasicSyncUdpClient(self):
        ''' Test the basic methods for the udp sync client'''

        # receive/send
        client = ModbusUdpClient()
        client.socket = mockSocket()
        self.assertEqual(0, client._send(None))
        self.assertEqual(1, client._send('\x00'))
        self.assertEqual('\x00', client._recv(1))

        # connect/disconnect
        self.assertTrue(client.connect())
        client.close()

        # already closed socket
        client.socket = False
        client.close()

        self.assertEqual("127.0.0.1:502", str(client))
开发者ID:zhanglongqi,项目名称:pymodbus,代码行数:21,代码来源:test_client_sync.py


注:本文中的pymodbus.client.sync.ModbusUdpClient.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。