query command port across Maya sessions

query command port across Maya sessions

Anonymous
Not applicable
531 Views
3 Replies
Message 1 of 4

query command port across Maya sessions

Anonymous
Not applicable
SO I open two sessions of Maya

In session 1 I open a command port via

commandPort -n ":8000";

If in session 1 I query the command port creation with:

commandPort -q ":8000";
// Result:1//

It sees the port.



But if in the second Maya session I query the commandPort via:

commandPort -q ":8000";
// Result:0//

It thinks the port has not been created. But port 8000 is taken and
cannot be used. How can I query that a command port is taken in this
way, across multiple session of Maya?


Joey
0 Likes
532 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Maya only knows about it's own session. I'd check with something like netstat -na.
0 Likes
Message 3 of 4

Anonymous
Not applicable
But it cannot generate a port at :8000 from session 2 even though query says the port is free. Hmmmm..., maybe I've got this backwards. I was trying to find the free port before creating it, seemed like the smart thing to do. Maybe I should just start trying to make sequential commandports and query if the result is true at each attempt then stop the process after the first succesful commandPort creation.

Joey
0 Likes
Message 4 of 4

Anonymous
Not applicable
Nope....that didn't work. Executing something that causes an error forces the userSetup.mel script to terminate. Can't execute a commandPort initialization with explicit port number. If it fails so does the rest of the mel script. Back to the drawing board.

What I'm trying to do is force a commandPort creation at Maya startup, but using a defined and available port number. If anyone knows how to accomplish this it would be appreciated.

Joey
0 Likes