Python socket.gettimeout() Examples

The following are 50 code examples for showing how to use socket.gettimeout(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

You may also check out all available functions/classes of the module socket , or try the search function .

Example 1
Project: ironpython2   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 2
Project: ironpython2   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 3
Project: ironpython2   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 4
Project: ironpython2   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 5
Project: ironpython2   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 6
Project: BinderFilter   Author: dxwu   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 7
Project: BinderFilter   Author: dxwu   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 8
Project: BinderFilter   Author: dxwu   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 9
Project: BinderFilter   Author: dxwu   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 10
Project: BinderFilter   Author: dxwu   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 11
Project: oss-ftp   Author: aliyun   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 12
Project: oss-ftp   Author: aliyun   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 13
Project: oss-ftp   Author: aliyun   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 14
Project: oss-ftp   Author: aliyun   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 15
Project: oss-ftp   Author: aliyun   File: test_timeout.py    License: MIT License 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 16
Project: Fluid-Designer   Author: Microvellum   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 17
Project: Fluid-Designer   Author: Microvellum   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 18
Project: Fluid-Designer   Author: Microvellum   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 19
Project: Fluid-Designer   Author: Microvellum   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 20
Project: Fluid-Designer   Author: Microvellum   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 21
Project: ironpython3   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 22
Project: ironpython3   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 23
Project: ironpython3   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 24
Project: ironpython3   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 25
Project: ironpython3   Author: IronLanguages   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 26
Project: gcblue   Author: gcblue   File: test_timeout.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 27
Project: gcblue   Author: gcblue   File: test_timeout.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 28
Project: gcblue   Author: gcblue   File: test_timeout.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 29
Project: gcblue   Author: gcblue   File: test_timeout.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 30
Project: gcblue   Author: gcblue   File: test_timeout.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 31
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 32
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 33
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 34
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 35
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 36
Project: medicare-demo   Author: ofermend   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 37
Project: medicare-demo   Author: ofermend   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 38
Project: medicare-demo   Author: ofermend   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 39
Project: medicare-demo   Author: ofermend   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 40
Project: medicare-demo   Author: ofermend   File: test_timeout.py    License: Apache License 2.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 41
Project: CTFCrackTools-V2   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 42
Project: CTFCrackTools-V2   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 43
Project: CTFCrackTools-V2   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 44
Project: CTFCrackTools-V2   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 45
Project: CTFCrackTools-V2   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1) 
Example 46
Project: CTFCrackTools   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testObjectCreation(self):
        # Test Socket creation
        self.assertEqual(self.sock.gettimeout(), None,
                         "timeout not disabled by default") 
Example 47
Project: CTFCrackTools   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testFloatReturnValue(self):
        # Test return value of gettimeout()
        self.sock.settimeout(7.345)
        self.assertEqual(self.sock.gettimeout(), 7.345)

        self.sock.settimeout(3)
        self.assertEqual(self.sock.gettimeout(), 3)

        self.sock.settimeout(None)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 48
Project: CTFCrackTools   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testReturnType(self):
        # Test return type of gettimeout()
        self.sock.settimeout(1)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0))

        self.sock.settimeout(3.9)
        self.assertEqual(type(self.sock.gettimeout()), type(1.0)) 
Example 49
Project: CTFCrackTools   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testTimeoutThenBlocking(self):
        # Test settimeout() followed by setblocking()
        self.sock.settimeout(10)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)

        self.sock.settimeout(10)
        self.sock.setblocking(0)
        self.assertEqual(self.sock.gettimeout(), 0.0)
        self.sock.setblocking(1)
        self.assertEqual(self.sock.gettimeout(), None) 
Example 50
Project: CTFCrackTools   Author: Acmesec   File: test_timeout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def testBlockingThenTimeout(self):
        # Test setblocking() followed by settimeout()
        self.sock.setblocking(0)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)

        self.sock.setblocking(1)
        self.sock.settimeout(1)
        self.assertEqual(self.sock.gettimeout(), 1)