XMLSocket.send() to Java

hi I have a question about this:
I use XMLSocket.send() to send things to Java. But if there’s 2 java programs in the same folder, how do I know to which one I want to send the message? There’s no option for this, unlike when I send informations to a server-side language, like this:
loadVariables(“myPHP.php”, “POST”)
what I’m saying is I can’t do this:
XMLSocket.send(“myApp.java”, myXML)

Cant you make them listen on different ports?

what do you mean?

When you are connecting to some socket server with XMLSocket.connect(), you specify a port on which you want to make connection and that application you are trying to connect to has to listen on that port… so
mySocket.connect(“localhost”, 2000) and
mySocket.connect(“localhost”, 3000)
could be two different applications…

thanks. But how do I set the .java file’s port so it can receive the right one?

You can modify it’s main function so you could choose a port when you launch the class file or change it pemanently in the source… look for a line with “new ServerSocket(portNumber);”

thanks!