Waiting TCP/UDP client app.
807598Jul 9 2006 — edited Jul 9 2006Hi,
I am not new to Java, but have only used a very limited array of Java's capabilities. I took an intro to object orriented programming in Java class and have been making small miscelanous apps here and there. So far what I know has been sufficient for what I wanted to do, or I have been able to find resources on the net that tell me what I need to know.
My most recent little project is a relatively simple app, but deals with threads, something that I understand but do not know how to impliment. I am trying to create a program that will log data coming in on a certian port. I have made simple TCP client progs before, but never one that has to wait and listen. The packets are directed to a commercial app that is already listening on that port (MSN Messenger, trying to make an advanced logging app for my gobs of convos), so after being intercepted the data would have to either continue through to messenger, or be resent to the local host and not intercepted again.
The only thing that I do not understand is how to tell the program to simply wait until it begins recieving data, execute the thread which would process this data, then re-enter the waiting state. I found a tutorial on wikipedia for this, but it was pretty brief and designed for a more knowlegable audience (this is how I know i need to use threads =P). If someone could explain how to do this, or direct me to some rather novice friendly tutorials it would be appreciated. Thanks in advance!
- Ignis