Created
November 21, 2018 13:14
-
-
Save zerobell-lee/49a7a7e68af70f59a1783fcf508c1f70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import * | |
import threading | |
import time | |
def send(sock): | |
while True: | |
sendData = input('>>>') | |
sock.send(sendData.encode('utf-8')) | |
def receive(sock): | |
while True: | |
recvData = sock.recv(1024) | |
print('상대방 :', recvData.decode('utf-8')) | |
port = 8081 | |
clientSock = socket(AF_INET, SOCK_STREAM) | |
clientSock.connect(('127.0.0.1', port)) | |
print('접속 완료') | |
sender = threading.Thread(target=send, args=(clientSock,)) | |
receiver = threading.Thread(target=receive, args=(clientSock,)) | |
sender.start() | |
receiver.start() | |
while True: | |
time.sleep(1) | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment