Skip to content

Instantly share code, notes, and snippets.

@teocci
Forked from mike-zhang/tcpClient1.py
Created August 1, 2017 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teocci/98bdfc0945bb37dbfac837e4a3a0f7dd to your computer and use it in GitHub Desktop.
Save teocci/98bdfc0945bb37dbfac837e4a3a0f7dd to your computer and use it in GitHub Desktop.
a simple tcp client(python code)
#! /usr/bin/python
# a simple tcp client
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('127.0.0.1', 12345))
#sock.send('Test\n')
sock.send(raw_input("Please input : "))
print sock.recv(1024)
sock.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment