From sgcWebSockets 4.4.8, WebSocket Protocol Files is supported by sgcWebSockets .NET Library.
This protocol allows sending files using binary WebSocket transport. It can handle big files with a low memory usage.
Features
To send a File to Server, just call the method SendFile of Files Protocol and pass the full FileName as argument.
The file received by server, will be saved by default in the same directory where is the server executable or in the Path set in the Files.SaveDirectory property.
// ... Create Server TsgcWebSocketServer oServer = new TsgcWebSocketServer(); TsgcWSPServer_Files oServer_Files = new TsgcWSPServer_Files(); oServer_Files.Server = oServer; oServer.Host = "127.0.0.1"; oServer.Port = 8080; // ... Create Client TsgcWebSocketClient oClient = new TsgcWebSocketClient(); oClient.URL = "ws://127.0.0.1:8080"; // ... Create Protocol TsgcWSPClient_Files oClient_Files = new TsgcWSPClient_Files(); oClient_Files.Client = oClient; // ... Start Server oServer.Active = true; // ... Connect client and Send File if oClient.Connect() then oClient_Files.SendFile("c:\Documents\yourfile.txt");
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.