Skip to content

Webcam - Transcode webcam images into live h264 stream example #638

Closed
@adelanteDev

Description

@adelanteDev

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 :

https://pastebin.com/w4QjzCkD

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions