我写了一个客户端和服务器端,客户端发到服务器端的信息,服务器端能够收到,但是服务器端发给客户端的信息,客户端就是收不到,这是怎么回事?
客户端接受的代码:
void CClientSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
char buff[17];
int bufflen=17;
Receive(buff,bufflen);
AfxMessageBox(buff);
CSocket::OnReceive(nErrorCode);
}
设了个断点,根本就运行不到这里,弄了两天了,都不知道怎么办?都凌晨一点了,帮帮忙,看看是什么原因会这样的,客户端和服务器端的Socket都是继承CAsynSocket.
服务器端发送的代码是在服务器端接收到客户端的消息后发送:
void CReceiveSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
char buff[17];
int bufflen=17;
Receive(buff,bufflen);
AfxMessageBox(buff);
Send(buff,bufflen);
CAsyncSocket::OnReceive(nErrorCode);
}
客户端接受的代码:
void CClientSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
char buff[17];
int bufflen=17;
Receive(buff,bufflen);
AfxMessageBox(buff);
CSocket::OnReceive(nErrorCode);
}
设了个断点,根本就运行不到这里,弄了两天了,都不知道怎么办?都凌晨一点了,帮帮忙,看看是什么原因会这样的,客户端和服务器端的Socket都是继承CAsynSocket.
服务器端发送的代码是在服务器端接收到客户端的消息后发送:
void CReceiveSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
char buff[17];
int bufflen=17;
Receive(buff,bufflen);
AfxMessageBox(buff);
Send(buff,bufflen);
CAsyncSocket::OnReceive(nErrorCode);
}
解决方案 »
- 双击的时候为什么 NM_DBLCLK 和 NM_CLICK 两个消息都触发了?▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
- 高分求助菜单问题
- 这个界面的这部分是如何实现,请进,帮我看看是用哪个控件做的,可能很简单的!
- 请大家来看一段程序,评评它有什么错。
- 怎么向数据库添加不了记录
- 对话框问题
- 小弟想编程实现局琙网内邮件发送功能,请问各位大哥需要哪些预备知识?
- 问一个很简单的问题,希望能得到解答
- 关于imagelist的问题。
- 谁能告诉我建立及应用ini文件的api?
- 急!我编了release版本的一个ocx控件,打成cab包后,为什么有的机器能用有的机器不能用呢?
- ◆◆◆◆如何把输出结果写入PPT中◆◆◆◆
[email protected]
void CClientSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
char buff[17];
int bufflen=17;
Receive(buff,bufflen);
AsyncSelect(FD_WRITE);
AfxMessageBox(buff); //有问题,CWinApp* pApp=(CWinApp*)AfxGetApp();
CSocket::OnReceive(nErrorCode);
}
http://www.yesky.com/SoftChannel/72342371928702976/20040521/1800089.shtml