Socket program for linux/unix – Solvline PB2xxxUG User Manual
Page 100

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) {
// Outputs data to the edit box.
rbuff[nBytesRead] = 0;
pEdt->ReplaceSel(temp);
}
}
CDialog::OnTimer(nIDEvent);
}
//Closes the socket when the program is shut down.
BOOL CSockExamDlg::DestroyWindow()
{
if(!p) p->Close ();
KillTimer(1);
KillTimer(2);
return
CDialog::DestroyWindow();
}
4. Socket Program for Linux/Unix
1) Passive Programming
Set the handshaking method to passive in the Webpage Connection Setting.
Passive handshaking makes the Portbase socket to be on the server side waiting for a connection
request from the outside.
Portbase’s sockets 4001 to 4016 are firmly connected to serial ports 1 to 16 respectively. For
100