My server.py looks like this
---------------------------------------------CODE----------------------------------
#!/usr/bin/env python
import socket
import sys
import os
s = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
host = ''
port = 2000
s.bind((host,po rt))
s.listen(1)
conn, addr = s.accept()
print 'client is at', addr
while True:
data = conn.recv(10000 00)
if (data == 'MaxSim'):
print 'MaxiSim'
os.system('note pad')
elif (data == 'Driving Sim'):
print 'Driving Sim'
os.system('expl orer')
elif (data == 'SHUTDOWN'):
print 'Shutting down...'
os.system('shut down -s')
conn.close()
break
-------------------------------------------CODE
END-------------------------------------
I am running this above program on a windows machine. My client is a
Linux box. What I want to achieve is that server.py should follows
instructions till I send a 'SHUTDOWN' command upon which it should shut
down.
When I run this program and suppose send 'MaxSim' to it, it launches
notepad.exe fine, but then after that it doesn't accept subsequent
command. I want is that it should accept subsequent commands like
Driving Sim and launch windows explorer etc untill I send a 'SHUTDOWN'
command.
Any help on this, it will be greatly appreciated.
---------------------------------------------CODE----------------------------------
#!/usr/bin/env python
import socket
import sys
import os
s = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
host = ''
port = 2000
s.bind((host,po rt))
s.listen(1)
conn, addr = s.accept()
print 'client is at', addr
while True:
data = conn.recv(10000 00)
if (data == 'MaxSim'):
print 'MaxiSim'
os.system('note pad')
elif (data == 'Driving Sim'):
print 'Driving Sim'
os.system('expl orer')
elif (data == 'SHUTDOWN'):
print 'Shutting down...'
os.system('shut down -s')
conn.close()
break
-------------------------------------------CODE
END-------------------------------------
I am running this above program on a windows machine. My client is a
Linux box. What I want to achieve is that server.py should follows
instructions till I send a 'SHUTDOWN' command upon which it should shut
down.
When I run this program and suppose send 'MaxSim' to it, it launches
notepad.exe fine, but then after that it doesn't accept subsequent
command. I want is that it should accept subsequent commands like
Driving Sim and launch windows explorer etc untill I send a 'SHUTDOWN'
command.
Any help on this, it will be greatly appreciated.
Comment