小编hav*_*vox的帖子

获取特定子字符串后面的字符串

如何在特定子字符串后获取字符串.

例如,我想以后得到的字符串"world"my_string="hello python world , i'm a beginner "

python string

186
推荐指数
9
解决办法
36万
查看次数

Errno 10061:无法建立连接,因为目标计算机主动拒绝它(客户端 - 服务器)

我有这些客户端和服务器代码的问题,我一直得到[Errno 10061]无法建立连接,因为目标机器主动拒绝它

我在使用Windows XP SP3的虚拟机上运行服务器,在Windows 7 64bit上运行客户端,我的python版本是2.7.3.我想知道的是我应该如何编辑代码以在不同的网络上使用客户端和服务器!谢谢!

服务器:

#!/usr/bin/python           # This is server.py file

import socket               # Import socket module
s = socket.socket()         # Create a socket object
host = '0.0.0.0' # Get local machine name
port = 12345                # Reserve a port for your service.


print 'Server started!'
print 'Waiting for clients...'

s.bind((host, port))        # Bind to the port
s.listen(5)                 # Now wait for client connection.
c, addr = s.accept()     # Establish connection with client.
print 'Got connection …
Run Code Online (Sandbox Code Playgroud)

python sockets

41
推荐指数
2
解决办法
14万
查看次数

标签 统计

python ×2

sockets ×1

string ×1