如何在客户端连接后立即发送数据 [英] How to send data as soon as client is connected
本文介绍了如何在客户端连接后立即发送数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在进行套接字编程,我需要在连接客户端后立即连续发送数据..
到现在我使用发送按钮在客户端连接后发送数据。但它在发送时导致延迟2到3秒..所以我想在客户端连接后立即发送数据
我在OnAccept()中写道,但它没有用......!
如何做到这一点..
提前谢谢...!
Hi all,
Im doing Socket Programming where I need to send data continuously as soon as client is connected..
till now im using Send Button to send data after client is connected.But it is causing delay of 2 to 3sec in sending.. so I want to send data as soon as client is connected
I wrote in OnAccept() but it didn''t worked...!
How to do that..
Thanks in advance...!
推荐答案
我创建了一个对象服务器类作为m_server。
在服务器类中我创建了CDialog
object* pDlg
所以在OnInitDialog()
我初始化如下
m_server.pDlg = this;
和OnAccept()
我发送消息IDC_BUTTON1
点击为
I have created a object server class as m_server.
in server class i have createdCDialog
object*pDlg
so inOnInitDialog()
I initialized as below
m_server.pDlg=this;
and atOnAccept()
I send message forIDC_BUTTON1
click as
CWnd* btn=NULL;
btn=pDlg->GetDlgItem(IDC_BUTTON1);
btn->GetParent()->SendMessage(WM_COMMAND,MAKEWPARAM(IDC_BUTTON1,BN_CLICKED),(DWORD)btn->m_hWnd);
并且它成功运行.... !
如果还有其他简单的方法请发布!
and it worked successfully....!
If there is another simple method please post it!
这篇关于如何在客户端连接后立即发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文