× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Charlie,

If you are truly connecting to an HTTPS server (as you say) then you need to be using SSL/TLS. The normal socket APIs aren't going to do the job, you need to call APIs capable of SSL. I recommend the GSKit API.

If you are actually connecting to an HTTP server (as opposed to HTTPS) which would make more sense, then ignore the preceding paragraph :)

At any rate, <test> isn't a valid HTTP operation.


On 1/26/2010 10:54 AM, Versfelt, Charles wrote:

Hi,

I'm Charlie, I'm an RPG programmer in New Jersey, working on my first project involving sockets--actually have two similar projects that will involve socket communications. No one at my company works with sockets.

I'm very new with sockets--I just started, so please bear with me.

I've read several articles by Scott Klement, downloaded the SOCKET_H file and started writing my first program, trying to communicate with an https server. For now, just for testing, I'm writing to one of our own Beta https website.

I set up the Host Table entry with the IP address of our beta website, and in my RPG program,
I have my gethostbyname( ), getservbyname( ), socket ( ), a connect( )
and I'm using the SendAscii prototype that combines QDCXLATE and send ( ).

For now, just to quick-test my connection, I'm just sending a little text message ("<test>") to the server.

From debugging the program, I seem to be getting a connection (I'm not coming back with -1).

The web programmer says that he sees I'm getting a connection and asked that I send my message to a specific folder within the main site.

So, where I'm currently connecting to beta.xxxxx.com he wants me to send to beta.xxxx.com/sub1/sub2

I can't find in any of the sockets documentation how to specify the sub1/sub2 part of the URL.

I thought perhaps the entire URL has to be part of the Host Table Entry, but it didn't like it.

Where do I define the URL with the "sub1/sub2" and tell it to send my data there?

Thanks,
Charlie

Here's some of my code:

p_hostent = gethostbyname(@Host);
if (p_hostent = *NULL);
.
.
. (Error handling Code)
else;
addr = h_addr;
endif;

(This seems to work)

p_servent = getservbyname(@Serv: @Prot);
if (p_servent<> *NULL);
port = s_port;
else;
port = tcdfpt;
endif;

(This is getting the correct port)

s = socket(@AFam: @STyp: @PFam);
If (s = -1);
.
.
. (Error handling code)
endif;

(This seems to work... Address family is 2, Socket Type is 1, Protocal Family is 6)

Then I do this...

connto = *ALLx'00';
connto.sin_family = @AFam;
connto.sin_addr = addr;
connto.sin_port = port;

// If error in connect.

if connect(s: %addr(connto): %size(connto)) = -1;

(error code)


Endif;


Then I do this...

SendAscii(s: '<test>');
Using '<test>' as my test message just to see if it worked.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.