Closed
Description
Hi, I have modified the above example for my needs. Now the structure of my project looks like this: Client1 sends the image to the server, the server saves it to disk and sends it to Client2. When I want my server to run more threads (I need several ports for different webcams).
My server :
`public class Server {
static List<Integer> ports = new ArrayList<Integer>();
public static void main(String[] args) {
ports.add(20000);
ports.add(20001);
if (args.length == 0) {
for (int i = 0; i < ports.size(); i++)
initPorts("localhost", ports.get(i));
} else {
}
}
public static void init(String host, int port) {
StreamServerAgent serverAgent = new StreamServerAgent();
serverAgent.start(new InetSocketAddress(host, port));
}
public static void initPorts(final String host, final int port) {
new Thread() {
@Override
public void run() {
init(host, port);
}
}.run(); }
Error :
I suspect that the problem is that although the image from Client1 is transmitted on one port, when the client connects to port 20001. It still receives the image from the client on port 20,000.
Metadata
Metadata
Assignees
Labels
No labels