support for running RobotRemoteServer() on remote machine other than localhost
giri81 opened this issue · 3 comments
it runs successfully when running RobotRemoteServer(ExampleRemoteLibrary(), host='127.0.0.1')
but it fails for other than localhost, RobotRemoteServer(ExampleRemoteLibrary(), host='200.20.57.10')
Traceback (most recent call last):
File "C:\eclipse\my_workspace\march_3\remote_server\server.py", line 32, in
RobotRemoteServer(ExampleRemoteLibrary(), host='200.20.57.10')
File "C:\Python27\lib\site-packages\robotremoteserver.py", line 60, in init
SimpleXMLRPCServer.init(self, (host, int(port)), logRequests=False)
File "C:\Python27\lib\SimpleXMLRPCServer.py", line 593, in init
SocketServer.TCPServer.init(self, addr, requestHandler, bind_and_activate)
File "C:\Python27\lib\SocketServer.py", line 419, in init
self.server_bind()
File "C:\Python27\lib\SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10049] The requested address is not valid in its context
Go into the file and change the localhost default address to 127.0.0.1 --- localhost normally emulates that address but for some reason it isn't in my machine so I am assuming that might be the case for you as well.
One you have the command line displaying that the server is running you can navigate to 127.0.0.1:7272 and see that the site is running.
class DemoServer(TCPServer):
allow_reuse_address = True
def __init__(self, port=PORT):
TCPServer.__init__(self, ('127.0.0.1', int(port )), SimpleHTTPRequestHandler)<---EDIT THIS LINE
def serve(self, directory=ROOT):
chdir(directory)
print 'Demo server starting on port %d.' % self.server_address[1]
try:
server.serve_forever()
except KeyboardInterrupt:
server.server_close()
print 'Demo server stopped.'
I don't have problems using other addresses than localhost or 127.0.0.1. For example, I can start the provided example library like
python example/examplelibrary.py 192.168.1.15
and then run tests like
robot --variable ADDRESS:192.168.1.15 example/example_tests.robot
Notice that my laptops public IP is that 192.168.1.15. It's obviously not possible to use other addresses than your machine has and that the current user can use.