Board index » delphi » Can the socket-client programmed with VB(Visual Basic) work with the socket-server with Indy TCPServer?

Can the socket-client programmed with VB(Visual Basic) work with the socket-server with Indy TCPServer?


2004-11-22 12:14:02 PM
delphi207
Recently I wrote a socket client program with VB. And I wrote a server
program with Indy 9 TidTCPServer too. Then I think it should be no problem
that the client connects the server. But it is not like I think. I met some
trouble. The server can only connects with client. It can't read any
messages from client. I also debuged it with adding breakpoint in ReadLn
line on the IdTCPServerExecute() event. But it is not response. I don't know
what it is problem. Anyone can help me answer this question. Why they can not
work ?
There are some code in server program:
procedure TForm1.IdTCPServerExecute(AThread: TIdPeerThread);
var
sCommand,ReplyMessage: string;
Datas:TStrings;
begin
Datas:=TstringList.Create ;
with AThread.Connection do begin
sCommand := ReadLn(); ////////////it's no response with debuging.
FLogEntry := sCommand + ' from client '+
AThread.Connection.Socket.Binding.PeerIP;
AThread.Synchronize(AddLogEntry);
SplitStrings(Datas,sCommand,'|');
if Datas[0]<>'' then ////start
begin
if Datas[0]='CheckLogin' then begin
ReplyMessage:='CheckLogin';
AdoQuery1.SQL.Text :='execute CheckLoginAccount
@CheckMan='''+Datas[1]+
''',@Password='''+Datas[2]+'''';
AdoQuery1.Open ;
if AdoQuery1.RecordCount=0 then
ReplyMessage:=ReplyMessage+'|0'
else
ReplyMessage:=ReplyMessage+'|1';
FReceived := sCommand;
WriteLn(ReplyMessage);
AThread.Synchronize(DisplayData);
end
end;
end;
end;
Thanks.
jacky
 
 

Re:Can the socket-client programmed with VB(Visual Basic) work with the socket-server with Indy TCPServer?

Sounds like mismatched line terminators to me. VB(Visual Basic) sending LF, Indy expecting
CR, something like that.
Rgds,
Martin
 

Re:Can the socket-client programmed with VB(Visual Basic) work with the socket-server with Indy TCPServer?

Get the (free) packet sniffer Ethereal, it will show you exactly what is
being transmitted, and you can learn what is going on.
Ciaran
"jacky" <XXXX@XXXXX.COM>writes
Quote
Recently I wrote a socket client program with VB. And I wrote a server
program with Indy 9 TidTCPServer too. Then I think it should be no problem
that the client connects the server. But it is not like I think. I met
some
trouble. The server can only connects with client. It can't read any
messages from client. I also debuged it with adding breakpoint in ReadLn
line on the IdTCPServerExecute() event. But it is not response. I don't
know
what it is problem. Anyone can help me answer this question. Why they can
not
work ?

There are some code in server program:

procedure TForm1.IdTCPServerExecute(AThread: TIdPeerThread);
var
sCommand,ReplyMessage: string;
Datas:TStrings;
begin
Datas:=TstringList.Create ;
with AThread.Connection do begin

sCommand := ReadLn(); ////////////it's no response with debuging.

FLogEntry := sCommand + ' from client '+
AThread.Connection.Socket.Binding.PeerIP;
AThread.Synchronize(AddLogEntry);
SplitStrings(Datas,sCommand,'|');
if Datas[0]<>'' then ////start
begin
if Datas[0]='CheckLogin' then begin
ReplyMessage:='CheckLogin';
AdoQuery1.SQL.Text :='execute CheckLoginAccount
@CheckMan='''+Datas[1]+

''',@Password='''+Datas[2]+'''';
AdoQuery1.Open ;
if AdoQuery1.RecordCount=0 then
ReplyMessage:=ReplyMessage+'|0'
else
ReplyMessage:=ReplyMessage+'|1';
FReceived := sCommand;
WriteLn(ReplyMessage);
AThread.Synchronize(DisplayData);
end
end;
end;
end;

Thanks.


jacky