TcpIpConnection to Web Server

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

TcpIpConnection to Web Server

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:51 pm

by Manjit >> Tue, 28 Jun 2005 4:43:21 GMT

Hi,
I am trying to open a TcpIpConnection to WebServer and get a response. I am able to open the Connection but not able to read the response.
My code is:
vars
oTCPConnection :TcpIpConnection;
begin
beginTransientTransaction;
create oTCPConnection sharedTransient;
oTCPConnection.name := "127.0.0.1";
oTCPConnection.port := 80;
oTCPConnection.localPort := 7777;

oTCPConnection.open();

sMessage := "GET /jade/jadehttp.dll?CRMWebService HTTP/1.1" &
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*" & "Accept-Language: en-au" &
"Accept-Encoding: ____, _______" &
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)" &
"Host:127.0.0.1" &
"Connection: Keep-Alive" & CrLf;

if oTCPConnection.state = Connection.Connected then oTCPConnection.writeBinary(sMessage.Binary);
endif;
if oTCPConnection.state = Connection.Connected then
write oTCPConnection.readBinary(200000).String; //this part never happens ??

commitTransientTransaction;

Any help much appriciated.


endif;

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: TcpIpConnection to Web Server

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:51 pm

by cnwjre1 >> Tue, 28 Jun 2005 5:23:16 GMT

You need a CrLf after each line of the Http request
e.g. "GET /jade/jadehttp.dll?CRMWebService HTTP/1.1" & CrLf &
..... each next line & CrLf &
and you need two CrLfs at the end.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 39 guests

cron