Skip to content

Instantly share code, notes, and snippets.

@zerobell-lee
Created November 21, 2018 12:30
Show Gist options
  • Save zerobell-lee/f3e2e3b07f4ddeee3c95dec107a05d6f to your computer and use it in GitHub Desktop.
Save zerobell-lee/f3e2e3b07f4ddeee3c95dec107a05d6f to your computer and use it in GitHub Desktop.
from socket import *
def send(sock):
sendData = input('>>>')
sock.send(sendData.encode('utf-8'))
def receive(sock):
recvData = sock.recv(1024)
print('상대방 :', recvData.decode('utf-8'))
port = 8080
clientSock = socket(AF_INET, SOCK_STREAM)
clientSock.connect(('127.0.0.1', port))
print('접속 완료')
while True:
receive(clientSock)
send(clientSock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment