Closed Diggensag closed 5 years ago
It seems that the TCP port is still running when you start the script. Did you try to kill its process?
Wow, you're fast.
Yes, i think so too. But after the first time I exit mnwifi I couldn't find a process (ps -fax | grep socket_server, usually this shows the process) and also not hints in netstat.
The second time (the time when the socket is already occupied) and I exit mnwifi, then it isn't able to stop and I have to kill it (then there is a process left).
Weird. Is there a way in which I could reproduce such behaviour?
I used the socket_server.py example with a modified socket_client.py script accessible from the stations via the call 'sta1 python2 /somedir/getgeocoords.py'
getcoords.py:
import socket
def client():
host = 'yourhostip'
port = 12345 # Make sure it's within the > 1024 $$ <65535 range
s = socket.socket()
s.connect((host, port))
message="get.sta1.position"
s.send(str(message).encode('utf-8'))
data = s.recv(1024).decode('utf-8')
print('Received from server: ' + data)
s.close()
if __name__ == '__main__':
client()
and then just ran socket_server.py it immediately after the first run had finished.
Try https://github.com/intrig-unicamp/mininet-wifi/commit/2e957e89e29c3f70e7f28bc2f425568313bac710 and let me know whether it solves the problem.
Awesome, small line, huge impact.
Looks good on my socket_server.py example. I will close this issue for now :-)
Hi Ramon,
is there a given time limit that I have to wait until I can run a emulation again (regarding reading the params via socket)? In the first run, mnwifi gets the appropriate socket and listens for connections. When I close the emulation and start it again, then it's still blocked, therefore no nodes can get the params via socket.
I've been able to reproduce this with socket_server.py.
Is this fixable or has it a certain timeout that I have to wait?
Backround: I have to run my emulations n-times, to be able to create median values and so on ;-)