Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Client Socket wont close and disconnect

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
429 Views, 0 Replies

Client Socket wont close and disconnect

I was able to use Mel Script to call python functions to connect to a socket. Connecting, sending and receiving works but I cannot close the socket and disconnect from server. The closing part is what bugs me. The closing function doesn't seem to be doing anything and I want to ask if anyone knows why or if this is a bug. I am using Maya 2016. The code is below.

 

 

python("import socket");
python("host = 'localhost'");
python("port = 7070");
python("client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)");
python("client.connect((host,port))");
//Set 4 seconds timeout 
python("client.settimeout(4)");
python("client.send("Test");
string $receivedData = python("client.recv(1000)");
print ($receivedData);
python("client.close()");

 

 

The  last line "python("client.close()");" is the part that doesn't work. I even tried running them on python directly instead of Mel script but I kept getting the same result. It just wont disconnect from the server. Any one got any ideas?

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report