![SystemBase Portbase-3010 Скачать руководство пользователя страница 111](http://html.mh-extra.com/html/systembase/portbase-3010/portbase-3010_user-manual_1423462111.webp)
Portbase User Guide
pEdt= (CEdit *)GetDlgItem(IDC_edtIPAddress);
pEdt->GetWindowText(m_ipaddr);
// Creates the socket.
p = new CAsyncSocket;
p->Create();
// Requests a connection by the socket number 4001.
if(p->Connect((LPCSTR)m_ipaddr, 4001) == 0) {
AfxMessageBox("Connection
fail");
return;
}
else AfxMessageBox("Connection success");
// Sets a timer for transmission.
SetTimer(1, 3000, NULL);
// Sets a timer for transmission.
SetTimer(2, 1, NULL);
}
// Adds a coding for transmitting and receiving data in the timer event routine.
void CSockExamDlg::OnTimer(UINT nIDEvent)
{
CEdit * pEdt = (CEdit *)GetDlgItem(IDC_edtWINDOW);
char WriteData[30] = "This is LoopBack Data !";
if(nIDEvent == 1) { //In case data is output to the socket.
p->Send(WriteData, strlen(WriteData));
}
if(nIDEvent == 2) { //In case data is inputted from the socket.
char rbuff[1000];
int nBytesRead;
nBytesRead = p->Receive(rbuff, sizeof(rbuff));
if(nBytesRead) {
111
Содержание Portbase-3010
Страница 1: ......
Страница 61: ...Portbase User Guide 4 Click Next 5 Choose destination location and click Next 61 ...
Страница 90: ...Portbase User Guide Log Window 90 ...