How to have a run in an Service?

Posted by user1497664 on Stack Overflow See other posts from Stack Overflow or by user1497664
Published on 2012-11-17T10:57:04Z Indexed on 2012/11/17 10:59 UTC
Read the original article Hit count: 134

Filed under:
|
|
|

I have implemented an service that runs in a seperate process.

This service contains a separate thread where i have a socket connection. This thread has a run() where it is continuously sending data to the port.

My problem is after triggering the run() in the thread i don't get any contact with it anymore, i can see in the program that have open the socket that it consciously sends the data but the idea was that i while it is running i could change data that it sends for an example time.

here is my run in the external thread:

public void run()
{

        if(run) 
            {

            // Team and player names message is sent when entering in a game

            setBaseMessage();
            SendMessageToCOMPort(base_message + CalculateCRC(base_message));
            sleep();  // waits for 100 ms
           }
}

Anyone have any idea what might be wrong ?

© Stack Overflow or respective owner

Related posts about java

Related posts about android