source: trigger/TestClient2.py@ 9059

Last change on this file since 9059 was 52, checked in by rissim, 16 years ago
trigger software (VME) v1
  • Property svn:executable set to *
File size: 643 bytes
Line 
1#!/usr/bin/python
2# Client program
3
4from socket import *
5
6# Set the socket parameters
7host = "localhost"
8port = 9992
9buf = 1024
10addr = (host,port)
11
12# Create socket
13ClientSock = socket(AF_INET,SOCK_STREAM)
14ClientSock.connect(('localhost', 9994))
15def_msg = "===Enter message to send to server===";
16print "\n",def_msg
17backdata=''
18data=''
19# Send messages
20while (backdata!="EXIT" and backdata!="exit"):
21 data = raw_input('>> ')
22 if not data:
23 break
24 else:
25 if(ClientSock.sendto(data,addr)):
26 print "Sending message '",data,"'....."
27 backdata=ClientSock.recv(1024)
28 if(backdata):
29 print "SERVER>>> ",backdata
30
31# Close socket
32ClientSock.close()
Note: See TracBrowser for help on using the repository browser.