 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Paul Guest
|
Posted: Sun Nov 21, 2004 11:32 am Post subject: HTTP client-server |
|
|
Hi,
I am trying to send commands to a HTTPserver that have to be executed on the
server immedialety
without sending a reply back to the client.
If I keep the connection alive , I can do this without specifying aUrl, ie
Client.Get(aCommand);
This way , I have to send back a reply from the server to the client, but
the
communication beteen the client and the server takes approx 1 second.
How can I prevent this communication ?
On the client I can send TCP commands like SendCmd( ). , which I cannot find
on the server.
How can I use these 'TCP'-commands and if so, are they HTTP incapsutalions?
Paul
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Nov 22, 2004 7:37 pm Post subject: Re: HTTP client-server |
|
|
"Paul" <paul.blommaerts (AT) telenet (DOT) be> wrote
| Quote: | I am trying to send commands to a HTTPserver that have to
be executed on the server immedialety without sending a reply
back to the client.
|
That is not how HTTP works. HTTP is a command-response architecture.
What EXACTLY are you trying to accomplish, and why are you using HTTP for
it?
| Quote: | This way , I have to send back a reply from the server to the client,
but the communication beteen the client and the server takes approx 1
second. |
So?
| Quote: | How can I prevent this communication ?
|
You don't. Not with HTTP.
| Quote: | On the client I can send TCP commands like SendCmd( )
|
SendCmd() waits for a reply as well.
Gambit
|
|
| Back to top |
|
 |
Paul Guest
|
Posted: Mon Nov 22, 2004 7:54 pm Post subject: Re: HTTP client-server |
|
|
Hi Remy,
I am trying to send commands to a remote PC (server) to control a machine.
Since it is behind a firewall, I must use HTTP.
I have tried TCP before, which works fine on my personal LAN .
I am now trying to do the same over HTTP.
I can get it to work with a 'Keep-alive' connection.
The commands are received on the server and the result is send back to the
client.
This works fine, except that after the command/result is send, I can see
there is
still a communication for approx 1 sec. afterwards.
In this 1 second period, I can't start the next command within the same
thread.
I'm not sure yet , but I think maybe this is the 'Keep-alive' communication
between
the client and the server afterwards.
It is very important to me to send a few commands/sec at times.
Is there a work around for this?
Paul
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Nov 22, 2004 9:37 pm Post subject: Re: HTTP client-server |
|
|
"Paul" <paul.blommaerts (AT) telenet (DOT) be> wrote
| Quote: | I am trying to send commands to a remote PC (server)
to control a machine. Since it is behind a firewall, I must
use HTTP.
|
Having a firewall does not mean that you are limited to HTTP. It just means
that the firewall only allows communications over port 80. There is a
difference between the two.
| Quote: | I can get it to work with a 'Keep-alive' connection.
The commands are received on the server and the result is
send back to the client. This works fine, except that after the
command/result is send, I can see there is still a communication
for approx 1 sec. afterwards.
|
See how exactly? What exactly are you looking at? On which side of the
connection?
| Quote: | In this 1 second period, I can't start the next command within the
same thread.
|
Please show your actual code. Sounds like your code itself is delayed.
| Quote: | I'm not sure yet , but I think maybe this is the 'Keep-alive'
communication between the client and the server afterwards.
|
There is no such communication. "Keep-alive" simply means that neither end
closes the socket after the response is transmitted. Nothing more. There
are no communications between a response and the next request.
| Quote: | It is very important to me to send a few commands/sec at times.
|
Then HTTP is probably not the right choice for you in the first place.
Gambit
|
|
| Back to top |
|
 |
Paul Guest
|
Posted: Mon Nov 22, 2004 10:19 pm Post subject: Re: HTTP client-server |
|
|
| Quote: | Having a firewall does not mean that you are limited to HTTP. It just
means
that the firewall only allows communications over port 80. There is a
difference between the two.
|
Not entirely true,
I know a few firms that filter out TCP on port 80 (one of them is a bank)
I have tested the communication again without the 'Keep-alive' option set
on the client and on the server as I did before.
It now works without the delay.
Paul
|
|
| Back to top |
|
 |
Robby Tanner Guest
|
Posted: Mon Nov 22, 2004 11:21 pm Post subject: Re: HTTP client-server |
|
|
"Paul" <paul.blommaerts (AT) telenet (DOT) be> wrote
| Quote: |
Having a firewall does not mean that you are limited to HTTP. It just
means
that the firewall only allows communications over port 80. There is a
difference between the two.
Not entirely true,
I know a few firms that filter out TCP on port 80 (one of them is a bank)
|
He was referring to the firewall you were talking about.
| Quote: | I have tested the communication again without the 'Keep-alive' option set
on the client and on the server as I did before.
It now works without the delay.
|
That's intriguing. You made no other changes?
Rob
|
|
| Back to top |
|
 |
Paul Guest
|
Posted: Tue Nov 23, 2004 8:38 pm Post subject: Re: HTTP client-server |
|
|
Hi Rob,
| Quote: | I have tested the communication again without the 'Keep-alive' option
set
on the client and on the server as I did before.
It now works without the delay.
That's intriguing. You made no other changes?
Rob
|
No, I only removed the Keep-alive connection on the client side.
The connection settings on the servers is stll 'Keep-alive'.
I am now testing with a small program.
The only thing it does is send a dummy command to the server
and wait for an answer.
The strange thing here is that when I press and cmdGet-button once,
I get a single respond from the server.
When I press and hold the button and stop after about 200 requests,
there is still a communication for a few seconds afterwards.
Is there a buffer that has to be cleared after each request?
Client :
Form1.Connect;
begin
HTTP1.Host:= '192.168.1.108';
HTTP1.Connect;
end;
procedure Form1.cmdGetClick(Sender: TObject); //button
onclick
var S: string;
begin
S:= HTTP1.Get('192.168.1.108');
label1.Caption:= S;
end;
Server :
procedure TServerForm.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var S,cmd:string;
begin
S:= ARequestInfo.Document;
inc (A);
AResponseInfo.ContentText:= 'Ready' + intToStr(A);
end;
Paul
|
|
| Back to top |
|
 |
|
|
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
|
|