G
Gargoyle
Need help please.
I am trying to write a small client-server application that uses a
ServerSocket that allows connection of two clients via two ports (one on each
port, say 3000 & 4000).
I've tried different techniques, but always get the first client working but
the second client waiting until after the first client has ended (see code
snippet below).
How should I approach this (without the use of threads)?
(I am using the loopback address of "127.0.0.1" as both clients are on the
same PC)
private ServerSocket ss1;
private ServerSocket ss2;
private Socket socket1;
private Socket socket2;
try
{
ss1 = new ServerSocket(3000);
ss2 = new ServerSocket(4000);
}
and then
socket1 = ss1.accept();
socket2 = ss2.accept();
I am trying to write a small client-server application that uses a
ServerSocket that allows connection of two clients via two ports (one on each
port, say 3000 & 4000).
I've tried different techniques, but always get the first client working but
the second client waiting until after the first client has ended (see code
snippet below).
How should I approach this (without the use of threads)?
(I am using the loopback address of "127.0.0.1" as both clients are on the
same PC)
private ServerSocket ss1;
private ServerSocket ss2;
private Socket socket1;
private Socket socket2;
try
{
ss1 = new ServerSocket(3000);
ss2 = new ServerSocket(4000);
}
and then
socket1 = ss1.accept();
socket2 = ss2.accept();