Hi, I am trying to control a relay via java client with two buttons, on and off. I wanted it to, when one of the buttons is pressed, send a byte to arduino over internet (ethernet shield). Once arduino recieves byte it analyzes the first four numbers (device identifier, will allow me to add more relays), and check if it has a match, once a match is found, I then want it to check the next four numbers, if they are all 1's then turn the pin that device is connected to high, if all are 0's then turn the pin low. I think sockets in java would do the trick? I am just confused on how get arduino to listen on port 80 for that byte? since they are two different languages I don't think they have the same things?
send a byte to arduino over internet (ethernet shield). Once arduino recieves byte it analyzes the first four numbers
How do you propose to find four number in a byte ?
There seem to be plenty of examples of how to use ethernet connections from the arduino.
ilovearduinosomuch:
I am just confused on how get arduino to listen on port 80 for that byte?
I assume you mean TCP port 80.
Just look at any of the example web server sketches. You haven't given much detail about the protocol you're going to use but I guess you're planning to send just a single byte, with a client ID encoded in the top four bits and a command state encoded in the bottom four bits. That's perfectly feasible. The fact that the client is written in Java is not a problem as long as you are capable of coding to the Java socket API.
Thank's peterh for responding! I am using Java as a client and when one of the buttons is pressed it sends a byte of data using TCP on port 80, You are right on the way I plan to send the byte and analyze the two sets of 4 bits. The java Client would send the byte and the arduino would be listening for that byte.