AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.74k stars 7.96k forks source link

Use http_stream.cpp and http_stream.h to connect socket on another machine #1032

Open komalpharate opened 6 years ago

komalpharate commented 6 years ago

Hi, I tried http_stream.cpp and http_stream.h. Works good on local setup. Can I use the same setup to stream over socket to another machine?

AlexeyAB commented 6 years ago

Hi, Yes, you can. Just type URL like this in the browser: http://ip-address:8090

komalpharate commented 6 years ago

Thanks for the reply. But want to run socket client on another machine. This client will get the output stream and display the stream in its browser.

komalpharate commented 6 years ago

To be more clear. My socket client is in Nodejs. Running on another VM. This VM will listen to Jetson's socket server. And display the stream wherever it wants

AlexeyAB commented 6 years ago

What error do you get?

komalpharate commented 6 years ago

As I said, The setup http://ip-address:8090 on machines which are in network or http://localhost/8090 on Jetson works for me. Now, I want to connect to socket server hosted on Jetson. Socket client in nodejs. What is the topic I should listen on?

AshleyRoth commented 6 years ago

@AlexeyAB Hello! I apologize, could not answer my question? What does this piece of code answer? I get an error cerr << "error : couldn't accept connection on sock " << sock << " !" << endl; during streaming. Thank you!

it's here

if (client == SOCKET_ERROR)
                {
                    cerr << "error : couldn't accept connection on sock " << sock << " !" << endl;
                    return false;
                }
AlexeyAB commented 6 years ago

@AshleyRoth

https://github.com/AlexeyAB/darknet/blob/24c889d85705643ca4860dea88827a7f1893b731/src/http_stream.cpp#L37 https://github.com/AlexeyAB/darknet/blob/24c889d85705643ca4860dea88827a7f1893b731/src/http_stream.cpp#L156-L160

Just read cases when accept() returns -1: http://man7.org/linux/man-pages/man2/accept.2.html#RETURN_VALUE

AshleyRoth commented 6 years ago

@AlexeyAB was read. So, it was a connection problem? if communication with the server / client is lost

AlexeyAB commented 6 years ago

@AshleyRoth This is problem (connection lost,...) when the new client try to connect to the Darknet.

AshleyRoth commented 6 years ago

@AlexeyAB The problem of the unstable connection between the darknet and the client, I correctly understood?

AlexeyAB commented 6 years ago

@AshleyRoth yes - in most cases

AshleyRoth commented 6 years ago

@AlexeyAB Okay, thanks! Last question, how many clients can connect to a darknet at the same time? Are there any restrictions in quantity?