I have a local computer A and remote computer B. Computer A has script client.py Computer B has server.py Script client.py has a variable port. Let's say port = 5535.
I am running client.py on Computer A, which is using the port number for socket communication. I need to change the port number to another port number while the client.py is running so it will switch to another server at runtime after notifying the client to change the port number. I am using pyzmq to send data from the client to the server sending a continuous stream of data.
Is this scenario possible and how can I do it?
Yes, it's possible. You may design / modify the (so far unseen) code so as to
PUSHany such need to change aport#on-the-fly to thePULL-side, to release the5535and use another one.The
PULL-side shall then call.disconnect()and.close()methods, so as to release the said port5535( plus notify that it has done so, perhaps by anotherPUSH/PULLto the.bind()-locked party, that it can now unbind and close the.bind()-locked port#5535too) and next setup a new connection to an announced "new_port#", received from the initial notification ( which ought have been already.bind()-locked on thePUSH-side, ought it not? :o) ).That easy.