Gente como eu faço pra aceita mais d euma conexão??
pq só pode ter uma conexão em cada porta e depois de conecta no ServerSocket outros sockets não podem se conectar
ServerSocket e Socket[Resolvido]
5 Respostas
Cara da uma olhada nesse tutorial, ele pode te ajudar…
http://www.guj.com.br/java.tutorial.artigo.126.1.guj
Ate
Já li varias vezes antes de vc me manda mas como eu faço pra abrir varias conexões??
na apositla FJ-11 da Caelum diz sobre criar uma classe que trata as conexões(…continuei na mesma…)
e vi tmb que apos abrir uma porta essa classe joga a conexão pra outra pra continuar recebendo outras conexões naquela porta
Olá
Tem bastante coisa interessante mas não entendi isso muito bem
Supporting Multiple Clients
To keep the KnockKnockServer example simple, we designed it to listen for and handle a single connection request. However, multiple client requests can come into the same port and, consequently, into the same ServerSocket. Client connection requests are queued at the port, so the server must accept the connections sequentially. However, the server can service them simultaneously through the use of threads - one thread per each client connection.
The basic flow of logic in such a server is this:
while (true) {
accept a connection ;
create a thread to deal with the client ;
end while
The thread reads from and writes to the client connection as necessary.
uma coisa que não rpendi direot é sobre Threads é oq vou começar a estudar agora mas por enquanto como ficaria pra aceita esses clientes?
Sorry não vi os exemplos