Last change
on this file since 9223 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 |
|
---|
4 | from socket import *
|
---|
5 |
|
---|
6 | # Set the socket parameters
|
---|
7 | host = "localhost"
|
---|
8 | port = 9992
|
---|
9 | buf = 1024
|
---|
10 | addr = (host,port)
|
---|
11 |
|
---|
12 | # Create socket
|
---|
13 | ClientSock = socket(AF_INET,SOCK_STREAM)
|
---|
14 | ClientSock.connect(('localhost', 9994))
|
---|
15 | def_msg = "===Enter message to send to server===";
|
---|
16 | print "\n",def_msg
|
---|
17 | backdata=''
|
---|
18 | data=''
|
---|
19 | # Send messages
|
---|
20 | while (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
|
---|
32 | ClientSock.close()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.