简体   繁体   English

如何使用C#将视频流发送到服务器?

[英]How to send a video stream to a server in C#?

I made a Windows Form Application which captures video stream from my webcam and saves it as an .avi file.(I used EMGUCV for that). 我制作了一个Windows Form应用程序,该应用程序从我的摄像头捕获视频流并将其保存为.avi文件(为此我使用了EMGUCV)。
How do i connect my client application to a server in order to send the video ? 如何将客户端应用程序连接到服务器以发送视频? I have no experience with sockets and client-server communication. 我没有套接字和客户端-服务器通信的经验。 Any ideas, code samples, links will be useful. 任何想法,代码示例,链接都将很有用。
Thanks in advance! 提前致谢!

It depends on the server. 这取决于服务器。 If it's an FTP server (which would be adequate for a video upload), use the WebClient object with the STOR method: 如果是FTP服务器(足以用于视频上传),则将WebClient对象与STOR方法一起使用:

    void Upload(string ftpServer, string userName, string password, string filename)
    {
        using(var client = new WebClient())
        {
            client.Credentials = new NetworkCredential(userName, password);
            client.UploadFile(new Uri(ftpServer + "/" + new FileInfo(filename).Name), "STOR", filename);
        }
    }

More info on the official documentation here . 有关官方文档的更多信息,请参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM