I'm trying to run a
thread that connects to a UDP socket, listens for incoming data, and processes said data appropriately. The method that does this -- which I've made run() -- works fine; it's well tested.
For some reason, though, depending on how I call it, it behaves oddly. After reading tutorials, I figured I could just create an instance of the object containing that run() method, and then call object.start(). It appeared to work, too; I got the status printout I'd set up to show that the socket was connected, I could send data on the socket (via a different method of that object), and reply data came in OK.
When I tried running the program and then sending it data from another location, without first sending data from it, nothing happened; it apparently never got the data. My first thought was that the socket wasn't properly connected, so I decided to, instead of calling object.start(), called object.run() directly. At this point, data was received and processed appropriately, but I had no control of the proram, as run() obviously had no return method.
The source files in question can be found at
www.schnarff.com/gnutonic/; they are runGnutonic.java (main program file) and connectionManager.java (thread implementation).
Any assistance would be greatly appreciated.
Alex Kirk