简体   繁体   English

通过TCP将uint发送到服务器C#

[英]Send uint over TCP to server c#

I'm trying to send an uint-Array to a Server. 我正在尝试将uint-Array发送到服务器。 But i don't know how to realise it. 但是我不知道如何实现它。 The uint[] looks like this: uint[]看起来像这样:

[0,0,0,0, 255,255,255, 255,255,255]

I'am working with the stream.Write methode but this methode is only working with a byte[] how can i convert a uint8[] to a byte[] or is there any chance to send a uint8[] over tcp? 我正在使用stream.Write方法,但是该方法仅在使用byte[]如何将uint8[]转换为byte[]或者有没有机会通过tcp发送uint8[] The problem is i can't access the source code on the server nor change it. 问题是我无法访问服务器上的源代码,也无法更改它。

EDIT: This is what i'm typing to the Chrome Console and it's working: 编辑:这是我在Chrome控制台中输入的内容,并且正在运行:

ws = new WebSocket("ws://localhost:7890")

to open the websocket connection and the rest: 打开websocket连接,其余的: 在此处输入图片说明

Thanks a lot 非常感谢

You could try to convert the array. 您可以尝试转换数组。 Something like: var byteArray = uintArray.Select(item=>(Byte)item).ToArray(); 像这样:var byteArray = uintArray.Select(item =>(Byte)item).ToArray();

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

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