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


Python errno.ESHUTDOWN属性代码示例

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


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

示例1: poll

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def poll(self, event, timeout):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)

        if event == "recv":
            if self.state.ESTABLISHED or self.state.CLOSE_WAIT:
                rcvd_pdu = super(DataLinkConnection, self).poll(event, timeout)
                if self.state.ESTABLISHED or self.state.CLOSE_WAIT:
                    return isinstance(rcvd_pdu, pdu.Information)
        elif event == "send":
            if self.state.ESTABLISHED:
                if super(DataLinkConnection, self).poll(event, timeout):
                    return self.state.ESTABLISHED
                return False
        elif event == "acks":
            with self.acks_ready:
                if not self.acks_recvd > 0:
                    self.acks_ready.wait(timeout)
                if self.acks_recvd > 0:
                    self.acks_recvd = self.acks_recvd - 1
                    return True
                return False
        else:
            raise err.Error(errno.EINVAL) 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:26,代码来源:tco.py

示例2: test_recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def test_recv(self, tco):
        pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
        assert tco.enqueue(pdu) is True
        assert tco.recv() == pdu
        threading.Timer(0.01, tco.close).start()
        with pytest.raises(nfc.llcp.Error) as excinfo:
            tco.recv()
        assert excinfo.value.errno == errno.EPIPE
        with pytest.raises(nfc.llcp.Error) as excinfo:
            tco.recv()
        assert excinfo.value.errno == errno.ESHUTDOWN


# =============================================================================
# Logical Data Link
# ============================================================================= 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:18,代码来源:test_llcp_tco.py

示例3: send

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def send(self, input):
            input = to_bytes(input)
            if not self.stdin:
                return None

            try:
                x = msvcrt.get_osfhandle(self.stdin.fileno())
                (errCode, written) = WriteFile(x, input)
            except ValueError:
                return self._close('stdin')
            except (subprocess.pywintypes.error, Exception) as why:
                if why.args[0] in (109, errno.ESHUTDOWN):
                    return self._close('stdin')
                raise

            return written 
开发者ID:refack,项目名称:GYP3,代码行数:18,代码来源:TestCmd.py

示例4: _recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def _recv(self, which, maxsize):
            conn, maxsize = self.get_conn_maxsize(which, maxsize)
            if conn is None:
                return None

            try:
                x = msvcrt.get_osfhandle(conn.fileno())
                (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
                if maxsize < nAvail:
                    nAvail = maxsize
                if nAvail > 0:
                    (errCode, read) = ReadFile(x, nAvail, None)
            except ValueError:
                return self._close(which)
            except (subprocess.pywintypes.error, Exception) as why:
                if why.args[0] in (109, errno.ESHUTDOWN):
                    return self._close(which)
                raise

            # if self.universal_newlines:
            #    read = self._translate_newlines(read)
            return read 
开发者ID:refack,项目名称:GYP3,代码行数:24,代码来源:TestCmd.py

示例5: _recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def _recv(self, which, maxsize):
            conn, maxsize = self.get_conn_maxsize(which, maxsize)
            if conn is None:
                return None

            try:
                x = msvcrt.get_osfhandle(conn.fileno())
                (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
                if maxsize < nAvail:
                    nAvail = maxsize
                if nAvail > 0:
                    (errCode, read) = ReadFile(x, nAvail, None)
            except (ValueError, NameError):
                return self._close(which)
            except (subprocess.pywintypes.error, Exception), why:
                if why[0] in (109, errno.ESHUTDOWN):
                    return self._close(which)
                raise 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:20,代码来源:subprocessng.py

示例6: _recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def _recv(self, which, maxsize):
            conn, maxsize = self.get_conn_maxsize(which, maxsize)
            if conn is None:
                return None

            try:
                x = msvcrt.get_osfhandle(conn.fileno())
                (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
                if maxsize < nAvail:
                    nAvail = maxsize
                if nAvail > 0:
                    (errCode, read) = ReadFile(x, nAvail, None)
            except ValueError:
                return self._close(which)
            except (subprocess.pywintypes.error, Exception) as why:
                if why[0] in (109, errno.ESHUTDOWN):
                    return self._close(which)
                raise

            #if self.universal_newlines:
            #    read = self._translate_newlines(read)
            return read 
开发者ID:turbulenz,项目名称:gyp,代码行数:24,代码来源:TestCmd.py

示例7: _recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def _recv(self, which, maxsize):
            conn, maxsize = self.get_conn_maxsize(which, maxsize)
            if conn is None:
                return None

            try:
                x = msvcrt.get_osfhandle(conn.fileno())
                (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
                if maxsize < nAvail:
                    nAvail = maxsize
                if nAvail > 0:
                    (errCode, read) = ReadFile(x, nAvail, None)
            except ValueError:
                return self._close(which)
            except (subprocess.pywintypes.error, Exception), why:
                if why[0] in (109, errno.ESHUTDOWN):
                    return self._close(which)
                raise

            #if self.universal_newlines:
            #    read = self._translate_newlines(read) 
开发者ID:kawalpemilu,项目名称:kawalpemilu2014,代码行数:23,代码来源:TestCmd.py

示例8: _recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def _recv(self, which, maxsize):
            conn, maxsize = self.get_conn_maxsize(which, maxsize)
            read = ""
            if conn is None:
                return None

            try:
                fd = conn.fileno()
                handle = get_osfhandle(fd)
                avail = c_ulong(0)
                PeekNamedPipe(handle, None, 0, None, byref(avail), None)
                nAvail = avail.value
                if maxsize < nAvail:
                    nAvail = maxsize
                if nAvail > 0:
                    read = os.read(fd, nAvail)
            except ValueError:
                return self._close(which)
            except (subprocess.pywintypes.error, Exception), why:
                if why[0] in (109, errno.ESHUTDOWN):
                    return self._close(which)
                raise 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:24,代码来源:subprocess2.py

示例9: _recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def _recv(self, which, maxsize):
            conn, maxsize = self.get_conn_maxsize(which, maxsize)
            if conn is None:
                return None
            
            try:
                x = msvcrt.get_osfhandle(conn.fileno())
                (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
                if maxsize < nAvail:
                    nAvail = maxsize
                if nAvail > 0:
                    (errCode, read) = ReadFile(x, nAvail, None)
            except ValueError:
                return self._close(which)
            except (subprocess.pywintypes.error, Exception):
                if geterror()[0] in (109, errno.ESHUTDOWN):
                    return self._close(which)
                raise
            
            if self.universal_newlines:
                # Translate newlines. For Python 3.x assume read is text.
                # If bytes then another solution is needed.
                read = read.replace("\r\n", "\n").replace("\r", "\n")
            return read 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:26,代码来源:async_sub.py

示例10: setsockopt

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def setsockopt(self, option, value):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)
        super(RawAccessPoint, self).setsockopt(option, value) 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:6,代码来源:tco.py

示例11: getsockopt

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def getsockopt(self, option):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)
        return super(RawAccessPoint, self).getsockopt(option) 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:6,代码来源:tco.py

示例12: send

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def send(self, send_pdu, flags):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)
        log.debug("{0} send {1}".format(str(self), send_pdu))
        super(RawAccessPoint, self).send(send_pdu, flags)
        return self.state.ESTABLISHED is True 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:8,代码来源:tco.py

示例13: recv

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def recv(self):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)
        try:
            return super(RawAccessPoint, self).recv()
        except IndexError:
            raise err.Error(errno.EPIPE) 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:9,代码来源:tco.py

示例14: connect

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def connect(self, dest):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)
        with self.lock:
            self.peer = dest
            return self.peer > 0 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:8,代码来源:tco.py

示例15: sendto

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESHUTDOWN [as 别名]
def sendto(self, message, dest, flags):
        if self.state.SHUTDOWN:
            raise err.Error(errno.ESHUTDOWN)
        if self.peer and dest != self.peer:
            raise err.Error(errno.EDESTADDRREQ)
        if len(message) > self.send_miu:
            raise err.Error(errno.EMSGSIZE)
        send_pdu = pdu.UnnumberedInformation(dest, self.addr, data=message)
        super(LogicalDataLink, self).send(send_pdu, flags)
        return self.state.ESTABLISHED is True 
开发者ID:nfcpy,项目名称:nfcpy,代码行数:12,代码来源:tco.py


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