Opening a Client-Side Socket for Sending Data : Client : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Client »

 

Opening a Client-Side Socket for Sending Data


import sys
from socket import *

serverHost = 'localhost'
serverPort = 50008
message = ['Client Message1', 'Client Message2']
sSock = socket(AF_INET, SOCK_STREAM)

sSock.connect((serverHost, serverPort))

for item in message:
    sSock.send(item)
    data = sSock.recv(1024)
    print 'Client received: ', 'data'

sSock.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» Client