如何发送一个字节(或字节)来测试在我的应用程序中监听的套接字?
How can I send a byte (or bytes) to test a TCP socket that's listening on a port in my application? My application receives a single byte that tells it what to do. Some operations will receive additional bytes to further instruct it.
如何发送一个字节(或字节)来测试正在我的应用程序中的端口上侦听的TCP套接字?我的应用程序收到一个字节,告诉它该做什么。某些操作将接收额外的字节以进一步指示它。
I tried using Telnet already, but when I input the int value, it seems to send the int (4 bytes).
我已经尝试过使用Telnet,但是当我输入int值时,它似乎发送了int(4个字节)。
I just need to send a single byte (8 bits), instead of a sequence of 4 bytes. Is there an easy way to test my socket application? Should I just create another application to test it?
我只需要发送一个字节(8位),而不是4字节的序列。有没有简单的方法来测试我的套接字应用程序?我应该创建另一个应用程序来测试它吗?
1 个解决方案
#1
6
You should not be using telnet for this.
你不应该使用telnet。
Better option is to use netcat.
更好的选择是使用netcat。
Then, pipe your command through bash
然后,通过bash管理你的命令
EG.
echo -n 0x03 | nc 127.0.0.1 1234
echo -n 0x03 | nc 127.0.0.1 1234
更多相关文章
- 〖Linux〗使用Qt5.2.0开发Android的NDK应用程序
- 如何测试已部署的Web应用程序
- 嵌入式linux 字节对齐 导致输出Alignment trap
- window下使用vnc远程登录linux图形界面和运行应用程序 和odroid
- [求助][CAB][安装包][CF2.0][SQL][setup]1000分请教:如何将CF2.0
- 【JavaWeb-6】HttpServletResponse的字符字节输出流、编码、文件
- 为什么我们应该将XMPP而不是JSON用于简单(仅文本)消息传递应用程序
- Android - 在一个应用程序中启动另外一个已经安装的应用程序或系
- Android混合应用程序:JQueryMobile ajax不支持https,但可以使用htt