Here is a quick example using Qt classes:

###
from functools import partial
from PySide import QtNetwork

def handleConn():
    conn = s.nextPendingConnection()
    conn.readyRead.connect(partial(readConn, conn))

def readConn(conn):
    data = conn.readAll()
    print "Read:", data


# Make a server
server = QtNetwork.QLocalServer()
server.newConnection.connect(handleConn)
server.listen('myLocalSocket')

# Make  client
sock = QtNetwork.QLocalSocket()
sock.connectToServer('myLocalSocket')
sock.write('foo\n')
###

You create a QLocalServer which uses local named sockets. Then you tell it to 
listen. It uses the event loop to wait for connections.
When a connection from a client comes in, the handleConn() is called. It 
accepts the connection and then connects it to another slot that will wait for 
data. This is all using signal/slots.
When the client writes data, the slot will be called. 

If you take this example and work up a test with it, I can help you further 
from your code.


On Jul 23, 2013, at 7:49 AM, Marcus Ottosson wrote:

> I came across this thread
> https://groups.google.com/d/msg/python_inside_maya/ycSqonujjJ8/bRPEnQAGE1cJ
> 
> ..but am not that familiar enough with network programming to understand 
> exactly what is going on. My problem seems similar, I want an externally 
> running PyQt application to get sent information from Maya. I'm trying to 
> setup a server within the PyQt app, but can't get around how to make it 
> concurrent.
> 
> Could I get a simplified example of how does could be achieved?
> 
> I made an example app here: http://pastebin.com/caRJX8qD
> Whenever the current node changes, I'd like this gui do show me the name of 
> that node via it's set(node) method.
> 
> Any ideas?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to