Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----testServer.java----
- import java.util.Properties;
- import org.python.util.PythonInterpreter;
- public class Server {
- public static void main(String args[]){
- Properties props = new Properties();
- props.setProperty("python.path", "C:\\panda3d-1.7.2\\python\\lib\\site-packages");
- PythonInterpreter.initialize(System.getProperties(), props, new String[] {""});
- PythonInterpreter python = new PythonInterpreter();
- python.execfile("src\\game\\Server.py");
- }
- }
- ----Server.py----
- from twisted.internet import reactor, protocol
- user=None
- password=None
- clients=[]
- class listen(protocol.Protocol):
- def connectionMade(self):
- client = self.transport.getPeer();
- print str(client) + " connected"
- self.transport.write("test")
- class factory(protocol.ServerFactory):
- protocol=listen
- def main():
- reactor.listenTCP(5000,factory())
- reactor.run()
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment