how to send response from server to client using python socket?
i want to communication between two system using python socket, in which one machine is local system(client) and another is public system(server), the code i write is : client.py import socket import commands import sys import time s = socket.socket() state = sys.argv pname = sys.argv user = commands.getoutput("whoami") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('22.214.171.124', 5001)) info = commands.getoutput("echo '%s','%s','%s','%s'"%(state,ip,user,pname)) while True: data2 = info s.sendall(data2) break server.py import socket import time import string import sys import base64 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('', 5001)) sock.listen(5) while True: newSocket, address = sock.accept() print "Connected from ", address filename = newSocket.recv(5001) while True: data = newSocket.recv(5001) if not data: break print filename, "Received\n" sock.close() After getting response from client to server, what to do if server want to send response to client ?
Substitute regex match groups where match groups may overlap
How to print out the first and last 1000 lines using beautiful soup
Call Grandparent Method without executing parent method through Mixin
Python/Pandas find closest value above/below in one Column
Pandas: set a default datetime for None values
NLTK can't find the Stanford POS tagger model file
Python __get__ differences between static instance and member
Splitting a 1-d numpy array from tdms file, and plot shorter time series/intervalls from the original array
Why there are more python processes than the number of cores in Spark?
Filling in a completely empty list of lists in an arbitrary order
How to create random orthonormal matrix in python numpy
Fill an image with pre-defined pattern with Wand
How to use a post_save receiver with django-polymorphic?
giving a name to a pandas dataframe?
mistake comparing datetime, python
numpy testing assert array NOT equal