Communication between mel exe and dll?

I am working on a Server program which links to maya through sockets, something like the mayaClockServer. The server is an .exe console application. I have a .mel script with UI interface, and this script will open and close the Server. Is there a way to pass data both ways between .mel and .exe without passing it through text file? Can I pass data between Maya Plug-ins and .mel script, because than maybee I can Create a plug-in which opens both my .exe and .mel and passes values between them. I cant find .mel commands to use the socket communication for two way data transfer. What is the best way of setting this up?

Bidita

that would solve lots of limitations .. but i am trying to evrything on mel or api ..
i need help on doing new ui interface controllers .. but mel doesnt allow that .. i hope api does ..

firas

How do you kill outside .exe's from inside Maya?

I create a timeout inside the exe file. Maya's mocap api internally communicates with the server exe application (, and when I stop the communication (closing the mel script) there is no more data , the timeout starts inside the exe file, and after 2 seconds it closes the application.
The other way to do it is to have the mel script write data to a file and have the exe file read it every few seconds, and react upon it. I could not set up direct 2-way communication between mel script and the exe file.
If someone know the answer how to do this, please reply to this link, we would appreciate it,
thanks,

Bidita

I'm not very well versed in socket programming, but I know MEL has a command called "commandPort" that...

"Opens (closes) the maya command port. The command port comprises a socket to which a client program may connect." (taken from MEL online docs)

I've only played with this command a bit. But, I was able to open a command port from MEL:

commandPort -n "mymachine:8888";

...and telnet to it...

telnet mymachine 8888

...and can than issue mel commands ("ls", "sphere", for example) to control the
running session of maya and also see info come back in the telnet session. I found this command as I was watching the script editor window when submitting batch renders. Is this what you are looking for?

Enjoy,

-Scott

Thanks for responding Scott.
This command may help a bit. I will test it, and post the result.I may be able to use it to send variable value from an exe file to a mel script,
but I still can't see how can I send the value of a variable from Mel directly to an exe file without using text file read and write commands. This communication does not need to go through sockets. Do you have any more ideas at this time Scott?
thank you,
Bidita

Thanks a lot Scott,
I tested the command commandPort, and it works for me.
I did the following to test it:
In Maya- commandPort -n "compname:8888";
In Dos- telnet compname 8888
In Maya- int $old = 46;
In Telnet (pasted)- int $new = $old;
The return value after this command in telnet is 46.
I am glad we solved this, thanks a lot,
Bidita

I've tried this as well, but telnet takes each character I type into it to Maya as a command.... basically I can't enter more than a single charcter into telnet. Example, if I tried to type "ls", Maya would see it as "l" "s". Have any ideas why this is happening?