Karen Baog

Ranch Hand
+ Follow
since Mar 02, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Karen Baog

Yep. I noticed that on W2000 OS it hardly relinquishes it. XP manages it better.

What can I do as I have it running on W2000?

I don't want to use sleep().
I have a Java app that uses threads.
Question is, how do you get it to yield so other (non-java) apps can have a chance to run, too?

yield() don't work. Or is it dependent on the OS?
I can speak for my own experience. Using an IDE to learn Java was much easier for me, although a lot of people say just to use something like notepad.

Using an IDE flags any typo error you may have, and that is very helpful. Mind you, I learned (it helps) to also learn to compile the hard way.

I used Borland Java Builder X.

Karen
18 years ago
For now, that is exactly what I have. here's the pseudo-code:

Thread1:
Listen indefinitely until packet is received
Packet finally received, so process
yield so other thread can run


Thread2:
Listen indefinitely until packet is received
Packet finally received, so process
yield so other thread can run


The problem I see with the above "approach" is that it is not a good approach, for the resource to be tied up until a packet is received is such a waste.

As you can receive packets you simply call the .getAddress() to get the IP address, and .getPort() to get the port.

For example,


Karen
[ August 16, 2005: Message edited by: Karen Baog ]
I'd like to have some examples. Any links?
If I use setSoTimeout(x), this would still mean running the thread, and wait for x milliseconds then throws an exception if no packet is received.

I could then just have yield() in the catch block, and not close the socket.

But is there a way where it would just automatically call it if a packet is received?


Still confused.
Hi,

I have a datagramsocket in a thread.
My confusion is this:

I want to only invoke it only when a packet is received.



Above snippet is inside a try catch block, but I just didn't show it.
The problem with the above snippet is that when this thread is run, and no packet is received it will just wait until a packet is received.
What I want is to only invoke the socket.receive(packet) if a packet is present, so the application can do other things.

Probably not put it in a thread? How then?


Hi Bert,

Check this out
Waterfall

On this site, please have a look at slide 6.
I would differ on his diagram, having arrows going back to every stage all the way back to the requirements definition.

There are are diagrams that Ian Sommerville has in this presentation (and his book) that I again would beg to differ. Slide 16, for instance, where after validating the system it only goes back to "Develop System increment" stage. The next requirements set for freezing is suppose to come from the start, which is "Define Outline Requirements".
18 years ago
So, I don't need to have some import statement. And, say, this SDK has some function called
int myFunc(int x)

? In my java code, does that mean I could write something like

int a = myFunc(2);

But I would expect an IDE would flag an error prior to compiling as this is not defined.

I'm using JBuilderX for my development. Is there a way (or possible) I could "include" this SDK in my JBuilderX directory structure?
18 years ago
Java Gurus:

I have an SDK that support many languages, including Java. How do I "include" this in my Java program so I can use the available functions?
18 years ago
Hi Ernest,

Finally, I traced it!
I persisted, thanks for your encouragement!


18 years ago
Hi,

I know the outputStream is not initialized.
I've been googling the web and can't find any example how this is initialized. The example that came with the comm API is not initialized either.

Still
18 years ago
I can't figure out why the outputStream could not be initialized. I've even put this line in the setup() method, but still hits this NullPointerException.

More
18 years ago
Hi all,

The data passed to the .write() method is definitely not null. So, I really am at a loss here why it would throw a NullPointerException error.

Karen
18 years ago