array of tcp connections

hello everyone,

I want to creat an array of servers to connect to (configurable hots:port) and send a command to be invoked like "something\n"

then close the tcp connection? whereis a good place to start reading about this or maybe a snip of code or two like the array part at least, I would be greatful. Any references is great... thank you.

[361 byte] By [h2opologirly69a] at [2007-11-27 8:01:28]
# 1
It's so simple, I don't know where's your problem actually. Simply create a collection of server information (host address and port), iterate over the collection, establish a socket connection to the server in every step, and finally send your command.
Arash.Shahkara at 2007-7-12 19:43:33 > top of Java-index,Core,Core APIs...
# 2
I am pretty new with tcp and java stuff never done it... that is why i am asking... ive only dont things with oracle...
h2opologirly69a at 2007-7-12 19:43:33 > top of Java-index,Core,Core APIs...
# 3

> I am pretty new with tcp and java stuff never done

> it... that is why i am asking... ive only dont things

> with oracle...

Then I wouldn't be worrying about arrays because that's the very least of your problems.

See this http://java.sun.com/docs/books/tutorial/networking/index.html

cotton.ma at 2007-7-12 19:43:33 > top of Java-index,Core,Core APIs...
# 4

I think reading the manual and learning would be a much better choice than asking for a very specific case, as it improves your knowledge and skill. Read these and you will be able to write your own stuff:

Socket documentation:

http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html

Collections framework documentation:

http://java.sun.com/j2se/1.5.0/docs/guide/collections/reference.html

Tutorial on how to use Sockets:

http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

Arash.Shahkara at 2007-7-12 19:43:33 > top of Java-index,Core,Core APIs...
# 5
thank you!
h2opologirly69a at 2007-7-12 19:43:33 > top of Java-index,Core,Core APIs...