12-03-2004, 08:34 AM | #1 (permalink) |
Insane
|
[java] Testing for Objects Existance
I know in C++ I can say
person bob; if (bob) { do something } how do I do something similar in java? I want to create a server socket if a suitable server exists to connect to. However I want this to scan all TCP ports (10.X.0.Y) and link to the first available port. How would I do this? |
12-03-2004, 01:20 PM | #2 (permalink) |
Insane
Location: Wales, UK, Europe, Earth, Milky Way, Universe
|
if (bob != null) {
do something } The second bit probably involves a while loop and an incremented port number variable until its connected or you reach the limit of the ports you want to scan but i'm not sure of the details about sockets in java. Should be easy once you know how to use a socket class though.
__________________
There are only two industries that refer to their customers as "users". - Edward Tufte |
Tags |
existance, java, objects, testing |
|
|