Hi,
I need a "client" function that connects to server, send data and close
connection.
My code is :
bool __fastcall TfrmMain::SendCde(int PortIP, AnsiString Cde)
{
bool Result;
int Sent;
WSocket->LineMode = true;
WSocket->LineEnd = "\r\n";
WSocket->Proto = "tcp";
WSocket->Port = PortIP;
WSocket->Addr = AdrIP;
WSocket->Connect();
try
{
Sent = WSocket->SendStr(Cde + "\r\n");
Result = (Sent == Cde.Length());
}
else
{
Result = false;
}
if ((WSocket->State == wsConnected) || (WSocket->State == wsConnecting))
WSocket->Close();
return Result;
}
Here, the result is false everytimes because the socket is never connected.
How could I do this function works ?
Thanks for help,
Engi
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be