Hello!
I´m trying to write a program that creates a tcp connection. For the server to wait for the client to connect I use the following code:
//Set the listening port
TcpServer1->LocalPort=StrToInt(ePort->Text);
//Try to listen;
TcpServer1->Listening;
//If the listen attempt succeeded
if (TcpServer1->Listening)
{
//Update the status bar
StatusBar1->SimpleText="Listening on port "+ ePort->Text;
//Set the application's listening flag
Listening=TRUE;
//Disable listen and connect buttons
bListen->Enabled=FALSE;
bConnect->Enabled=FALSE;
}
else
StatusBar1->SimpleText="Error-error-error...";
}
I´m doing something wrong because I always get the "Error-error-error..." message in the status bar. Does anybody know what I'm doing wrong. I have also tried with WaitForConnection but it doesn´t work or I don´t know how to make it work.
Thanks in advance.
Martintxo
I´m trying to write a program that creates a tcp connection. For the server to wait for the client to connect I use the following code:
//Set the listening port
TcpServer1->LocalPort=StrToInt(ePort->Text);
//Try to listen;
TcpServer1->Listening;
//If the listen attempt succeeded
if (TcpServer1->Listening)
{
//Update the status bar
StatusBar1->SimpleText="Listening on port "+ ePort->Text;
//Set the application's listening flag
Listening=TRUE;
//Disable listen and connect buttons
bListen->Enabled=FALSE;
bConnect->Enabled=FALSE;
}
else
StatusBar1->SimpleText="Error-error-error...";
}
I´m doing something wrong because I always get the "Error-error-error..." message in the status bar. Does anybody know what I'm doing wrong. I have also tried with WaitForConnection but it doesn´t work or I don´t know how to make it work.
Thanks in advance.
Martintxo