c ++ - recv()如何将字节转换回消息?

时间:2016-09-14 01:23:48

标签: c++ client-server send winsock2 recv

所以我的代码将recv()的结果存储到int var

int iResult;
char recvbuf[DEFAULT_BUFLEN];
int recvbuflen = DEFAULT_BUFLEN;

iResult = recv(ClientSocket, recvbuf, recvbuflen, 0);

我寄给你的

char *sendbuf = "this is a test That is longer then what it was";
char recvbuf[DEFAULT_BUFLEN];

iResult = send(ConnectSocket, sendbuf, (int) strlen(sendbuf), 0);

那么如何将收到的字节作为服务器端的char字符串返回?

0 个答案:

没有答案