When I use serverName.write() it sends out data to every client. I want to only send data to one client even when connected to multiple clients. I've tried creating an array of servers so that the client would only connect to one of them, but that didn't work; when it called serverName[serverNumber].write() it still wrote to all clients connected to the entire server program. If its relevant, the two client programs and one server program were all running on my computer. This was my attempt:
The client was essentially the same as the processing example for
Client, but displays the text "MULTIPLE INPUT" to the program's screen if it gets 2 bytes or more in its buffer (which I don't think is a perfect test, but with other tests it seems to confirm that it is indeed getting two different values from the two different litttleServers).
The client:
I've been learning processing's network library and, as the title says, I want to make it so that the server sends information to that information's one specific user. To clarify, I don't think using the .write() method to write to all the clients and then having the client only accept their own information would work because 1. I don't trust the client to not get the source code, modify it, and have it accept other people's information, and 2. If I'm not mistaken, that wastes alot of bandwidth as I have to send the data to many people who don't need it.
I considered having the users each create their own "server" and have the true server be their client, but I don't think that would work because I'm guessing the user would have to use port forwarding to make the connection which is too much to expect from the user (there might be other reasons too).
Hello, I'm making a program that involves the user inputting an equation that my program needs to be able to calculate the value of. Now, I know pretty much for certain that given enough time and patience I could probably have some kind of algorithm that went through the string of the equation and came up with some procedure to calculate the value of it. However, not only is this pretty complicated, I don't have that much time to do it.
So I was wondering, is there was a way to take an inputted string and execute it as though it were code? For example if the person inputted sin(sq(x)) (which can then easily convert that to x = sin(sq(x)); if that's needed), if there was some simple way to execute that.
Failing that, is there some kind of calculator class that can take a string with an equation and come up with a value? Are there other options I'm not seeing?