BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can the socket-client programmed with VB work with the socke

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
jacky
Guest





PostPosted: Mon Nov 22, 2004 4:14 am    Post subject: Can the socket-client programmed with VB work with the socke Reply with 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 not 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's 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



Back to top
Martin James
Guest





PostPosted: Mon Nov 22, 2004 9:33 am    Post subject: Re: Can the socket-client programmed with VB work with the s Reply with quote



Sounds like mismatched line terminators to me. VB sending LF, Indy expecting
CR, something like that.

Rgds,
Martin


Back to top
Ciaran Costelloe
Guest





PostPosted: Wed Nov 24, 2004 10:23 pm    Post subject: Re: Can the socket-client programmed with VB work with the s Reply with quote



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" <jacky.ke.jin (AT) 126 (DOT) com> wrote

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 not 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's 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






Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.