sockets would easily be the best idea here, especially since you don't even have to write the different pieces in the same language.
connecting to a server via sockets in python is easy as pie:
Code:
import socket
s = socket.socket(AF_INET, SOCK_STREAM)
s.connect((hostname, portnumber))
s.write("some data\n")
s.read(1024) #bytes sent back from the server
s.close() it really is that easy. and having a python socket listen on a specific port is just as easy...