public void sendFile(string eventName, LinkIOFile file) { throw new NotImplementedException(); }
public void sendFile(string eventName, LinkIOFile file, List<User> receivers) { throw new NotImplementedException(); }
public LinkIOFile sendFile(string eventName, Stream stream, String fileName, double validity) { LinkIOFile file = new LinkIOFile(); int length = (int)stream.Length; int nbChunk = (int)Math.Ceiling((double)length / CHUNK_SIZE); int chunkID = 1; socket.Emit("upload.start", new AckImpl((fileID) => { file.FileID = fileID.ToString(); byte[] buffer = new byte[CHUNK_SIZE]; int bytesRead; while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0) { Console.WriteLine("Sending " + chunkID + "/" + nbChunk); socket.Emit("upload.chunk", buffer); chunkID++; } socket.Emit("upload.end"); Console.WriteLine("Done."); }), fileName, eventName, nbChunk, validity); return file; }