×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.





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:

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

This mailing list archive is Copyright 1997-2026 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.