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


Python Client.connect方法代码示例

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


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

示例1: getindex

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
 def getindex(self):
     try:
         num = int(self._input('Peer Num : '))
         peer = self.vpn.get_peer_by_num(num)
         clt = Client(self.vpn)
         print "[+] Connecting to %s at %s:%d ... [Ctrl+c]" % (peer[1], peer[2], peer[3])
         clt.connect(peer[2], peer[3], (peer[4],peer[5]))
         print "[+] Connected"
         print "[+] Get Index ..."
         clt.get_index(peer[0])
         clt.close()
     except Exception as e:
         print "[Error]", e
     except KeyboardInterrupt:
         print "[!] Connection close"
     else:
         print "[+] Index downloaded"
开发者ID:sok63,项目名称:vpyn,代码行数:19,代码来源:VPyN.py

示例2: downloadfile

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
 def downloadfile(self):
     try:
         num = int(self._input('Peer Num : '))
         peer = self.vpn.get_peer_by_num(num)
         idfile = int(self._input('File ID : '))
         name = Index(peer[0]).get_file_by_id(idfile)[1]
         clt = Client(self.vpn)
         print "[+] Connecting to %s at %s:%d ... [Ctrl+c]" % (peer[1], peer[2], peer[3])
         clt.connect(peer[2], peer[3], (peer[4],peer[5]))
         print "[+] Connected"
         print '[+] Get File "%s" ...' % name
         clt.get_file(idfile, name)
         clt.close()
     except Exception as e:
         print "[Error]", e
     except KeyboardInterrupt:
         print "[!] Connection close"
     else:
         print "[+] File downloaded"
开发者ID:sok63,项目名称:vpyn,代码行数:21,代码来源:VPyN.py

示例3: CreateVisitorCommand

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
class CreateVisitorCommand(CreateContextCommand):
    def __init__(self, id, server, previous_operator = None, required_operator = None):
        CreateContextCommand.__init__(self)
        self.id = id
        self.server = server
        self.previous_operator = previous_operator
        self.required_operator = required_operator

    def process(self):
        self.visitor = Client(self.server)
        ok, error = self.visitor.connect()
        return ok, self.visitor if ok else error
开发者ID:antofik,项目名称:Python,代码行数:14,代码来源:tests.py

示例4: Client

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
from Client import Client


clientA= Client()

clientA.connect()

while True:
    user_input=input("Type message")
    clientA.send_message(user_input)
    print(clientA.recv_message())
开发者ID:QewBeats,项目名称:py_chat,代码行数:13,代码来源:clientA.py

示例5: Client

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
from Client import Client
from sys import stdin
from Const import Const


client = Client(Const.SERVER_IP, Const.SERVER_PORT)
client.connect()
client.create_listen_thread()

print("Chat started: ")
while True:
    msg = stdin.readline(Const.SERVER_PORT)
    client.send_message(msg)



开发者ID:code8080,项目名称:PyChannelChat,代码行数:15,代码来源:ClientMain.py

示例6: Client

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
__author__ = 'Chema'
from Client.Client import *

y = Client("192.168.1.10",2525)
y.connect()
y.command()
开发者ID:josmarber,项目名称:Dispensadora,代码行数:8,代码来源:ClientTest.py

示例7: Client

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import connect [as 别名]
from Client import Client


clientB= Client()

clientB.connect()

while True:
    user_input=input("Type message")
    clientB.send_message(user_input)
    print(clientB.recv_message())
开发者ID:QewBeats,项目名称:py_chat,代码行数:13,代码来源:clientB.py


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