I'm trying to send thumbs image from my c# application to Node using socket.io client for c#
private async Task getImagefiles()
{
DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "pptImages");
Byte[] fileThumb;
string idThumb;
int totalFiles= di.GetFiles().Length;
try
{
for (int count = 1; count <= totalFiles; count++)
{
fileThumb = File.ReadAllBytes(AppDomain.CurrentDomain.BaseDirectory + "pptImages\slide" + count + ".png");
idThumb = count.ToString();
pptThumbs.Add(idThumb, fileThumb);
pptThumbs2.Add(idThumb, JsonConvert.SerializeObject(fileThumb));
string result = JsonConvert.SerializeObject(fileThumb);
Globals.socket.EmitAsync("slideThumbs", JObject.FromObject(new
{
tokenE = Globals.tokenE,
idSlide = count,
thumb = result
}));
Thread.Sleep(300);
}
}
catch (Exception err){
Console.WriteLine(err.Message);
}
}
From node result is invalid Payload randomly.
server side is only one conole log
socket.on('slideThumbs', async(dataJson) => {
if (dataJson)
{
console.log(dataJson);
}
With arrayBuffer I don't have this problem, but in the client I can't get the image to render
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…