I'm currently writting a TCP/IP client in Java. The only thing that the client should be able to do is to run code that the server sends to it. I have seen this question , but my problem is that the code would be ran like if it was another application, but if the client code contains a string and the server sends a message saying, read the string and send back the content, then the client would not be able to do so because that code would be executed in another program where that string dosen't exist :-(
So is there a way that i can run code from a input like if it was written in the source code of the program?
All help is much appreciated :-)
Example:
The client contains a string that says "string0001". The client should run the code that the server sends. The server sends a block of java-code that the client shouls be able to execute. The code says: check content of string and send it back to this ip. The client should now be able to read the string and send back "string0001" to the servers ip.
With the solution that the link provided, the code that the server sent would be executed like if it was another program, and in that program the string that the server requested the client to read does not exist.
The client whould now be able to run the code like if it was written in the clients source, where the string exist.
Hope that helps :-)