multiple connection in a serversocket using TCP

can anyone provide an example on how to write a program which can accept a multiple connection in one serversocket?
[122 byte] By [kc_ausa] at [2007-10-3 7:24:09]
# 1

Go to http://java.sun.com/docs/books/tutorial/networking/sockets/index.html (easy enough to find if you need it later; it's the first google hit for java socket tutorial). The page "Writing a Client/Server Pair" contains an example "Supporting Multiple Clients".

If you need to support more than, say, 100-200 simultaneous clients a NIO selector approach gets better than a thread-based server. But selectors are a bit more complex.

sjasjaa at 2007-7-15 2:22:28 > top of Java-index,Archived Forums,Socket Programming...
# 2

> can anyone provide an example on how to write a

> program which can accept a multiple connection in one

> serversocket?

A ServerSocket is a socket that creates multiple individual socket connections. Therefore, you already have what you need.

I think you may want to reparse, by saying that you want to know how to handle multiple clients at the same time - i.e. Multi-threaded server.

Do a search on this on the web, the forum, sun site, or check out the docs link the other poster gave you.

watertownjordana at 2007-7-15 2:22:28 > top of Java-index,Archived Forums,Socket Programming...