메신저에 대해 배우려는 메신저와 IP 포트에 연결할 수 없습니다.소켓 - 파이썬을 연결하려고 할 때 소켓 오류가 발생합니다.
스티의 소켓 테스트 도구
import socket
print "send request to website to check if sockets work right"
ip = raw_input("website ip: ")
port = raw_input("website port: ")
socket.connect(ip, port)
tosend = "this is a test"
currVal = 0
while currVal < 1:
socket.send(tosend)
print "1 sockets sent..."
currrVal += 1
print "Done sending sockets. This hopefully worked"
는 파이썬 코드와 아무 잘못이 : 이 내가 가진 스크립트입니다? 이것은 ipv4 또는 ipv6에서만 작동합니까? 아니면 둘 다 작동합니까?
오류 IM은 방법 :
C:\Users\Swipper\Documents\Python\sockets>sock.py
send request to website to check if sockets work right
website ip: 127.0.0.1
website port:
Traceback (most recent call last):
File "C:\Users\Swipper\Documents\Python\sockets\sock.py", line 8, in <modu
le>
socket.connect(ip, port)
AttributeError: 'module' object has no attribute 'connect'
희망 누군가가 답을 알고있다.
PS : 저는 python 2.7을 사용합니다!
-stian
귀하의 질문은 모호합니다. 정확한 오류를 포함하십시오. –