AsyncSocket writeData 终止符

发布于 2024-10-01 22:51:23 字数 461 浏览 1 评论 0原文

我正在将 Java 中间件客户端移植到 objC。 java客户端在发送结束时使用javastream.write和stream.flush。为了让java客户端发送到Echo服务器,我需要添加stream.writeBytes("\r\n");接下来是stream.flush,让服务器退回消息。

我正在使用 asyncsocket 向中间件的服务器发送消息,但是在成功打开套接字后,中间件不会对使用发送的消息做出反应。

[socket writeData:sendData withTimeout:-1 tag:0]; 

此外,当套接字关闭时,中间件不会对缓冲区中的消息做出反应。

我目前正在使用

[socket writeData:[AsyncSocket CRLFData]  withTimeout:-1 tag:0];

冲洗插座

I am porting a Java middleware client to objC. The java client uses the java stream.write and stream.flush at the end of the send. For the java client to send to the Echo server I need to add the stream.writeBytes("\r\n"); followed by stream.flush for the server to bounce the message back.

I am using the asyncsocket to send messages to the middleware's server, but after successfully opening the socket, the middleware does not react to a message sent using

[socket writeData:sendData withTimeout:-1 tag:0]; 

Also the middleware does not react to the message in the buffer when the socket is closed.

I am currently using

[socket writeData:[AsyncSocket CRLFData]  withTimeout:-1 tag:0];

to flush the socket

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾其所爱 2024-10-08 22:51:23

我知道这不会是最后一次假设会回来告诉我。

我假设 java.io 写入与 BSD send 或 sendto 相同,但从其他帖子来看,我现在假设 java.io.DataOutputStream 实际上类似于 NSMutableData 并且写入是appendData。这意味着 writeInt 是一个 Endian 函数,flush 是实际的 send/sendto 命令。

I know this will not be the last time an assumption will come back to byte me.

I assumed that the java.io write was the same as BSD send or sendto, but from other posts, I am now assuming that the java.io.DataOutputStream is actually similar to NSMutableData and the write is appendData. Which means that writeInt is an Endian function and flush is the actual send/sendto command.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文