winsock发送消息错误 [英] winsock sending message error

查看:78
本文介绍了winsock发送消息错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿我使用winsocks制作客户端/服务器程序,我已设法将客户端连接到服务器但是当我尝试从客户端向服务器发送消息时,消息无法正确显示。 />

我在发送之前测试过该消息,看它是否正确和长度,看起来不错,但是当我在服务器上检查它时,它甚至不是相同的长度,更不用说可读了。


这是我用来从客户端发送消息(普通纯文本)的代码

Hey im making a client/server program using winsocks, i have managed to connect the client to server but when i try to send a message from the client to the server, the message doesn''t make it correctly.

I have tested the message before i sent it to see if its correct and the length, it seems fine but when i check it on the server prog its not even the same length, let alone readable.

This is the code im using to send the message (normal plain text) from the client

展开 | 选择 | Wrap | 行号

推荐答案

您是否测试过该消息是否正确发送了?


您是否测试过该消息是否已正确收到?
Did you test nret that the message was sent properly?

Did you test nret that the message was received properly?


嘿抱歉回到msg这么晚了iv离开了一会儿,无论怎样我怎么去测试nret正确发送和正确收到的消息。


感谢任何帮助
Hey sorry about getting back to the msg so late iv being away for a while, anyhow how would i go about testing nret for properly sent and properly received message.

Any help is appreciated


send和recv应返回发送或接收的字节数或-1(至少在我的系统上)以发现错误
send and recv should return the number of bytes sent or received or -1 (at least on my system) for error


这篇关于winsock发送消息错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆