Monday, March 9, 2015

Download Composite Design-Pattern.ppt

   No comments     

Friday, March 6, 2015

TCPClient.py

   No comments     
categories: 
# Python TCP Socket Client Application
from socket import *
serverName = 'localhost'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName, serverPort))
sentence = raw_input('Input lowercase sentence:')
clientSocket.send(sentence)
modifiedSentence = clientSocket.recv(1024)
print 'From Server:', modifiedSentence
clientSocket.close()

TCPServer.py

   No comments     
categories: 
# Python TCP Socket Server Application
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('', serverPort))
serverSocket.listen(1)
print 'The server is ready to receive'
while 1:
connectionSocket, addr = serverSocket.accept()
sentence = connectionSocket.recv(1024)
capitalizedSentence = sentence.upper()
connectionSocket.send(capitalizedSentence)
connectionSocket.close()

UDPClient.py and UDPServer.py

   No comments     
categories: 
UDPClient.py
UDPServer.py

if you copy the code from the book and run then you'll end up with errors
because the text formatting is there in the code

 UDPClient.py code is available here

UDPServer.py code is available here