Home > Net >  Regarding Windows-universal-samples of Microsoft
Regarding Windows-universal-samples of Microsoft

Time:07-28

Could any one tell me this code 1 , is this function runs every time when it gets a new video frame, if yes then I made a thread after line 188 which basically make a TCP connection with the server and send that frame to server. But the problem is if this function runs every time it make every time new thread and make new socket connection, but I want this thread to make one time connection and then send frame every time it get to the already connected TCP socket. The thread I am making is with this code,

Task task = new Task(() => { _helper.TcpConnectAndSend(originalBitmap); });
task.Start();

Windows-universal-samples

CodePudding user response:

but I want this thread to make one time connection and then send frame every time it get to the already connected TCP socket.

As Raymond Chen said, you called TcpConnectAndSend each time after getting frame that will make connecting repeatedly.

The better way is connect TCP socket after camera initialize, and then call send method for each fream.

  • Related