Created
April 10, 2018 14:22
-
-
Save lst15/3eb40180acefb1f94b2c270b92e74fdb to your computer and use it in GitHub Desktop.
cliente.chat.python
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
| import socket | |
| serverhost = '127.0.0.1' #IP DO SERVIDOR | |
| serverport = 666 #PORTA DE COMUNICAÇÃO DO SERVIDOR | |
| nameuser = socket.gethostname() | |
| socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| socket.connect((serverhost,serverport)) | |
| while True: | |
| socket.send(nameuser + ': ' + raw_input('Voce: ')) | |
| print 'Servidor: ' + socket.recv(1024) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment