http socket classes

Posted by jmls on 09-May-2014 02:22

After a couple of requests, I've dug out some code that creates simple-to-use classes to connect to sockets like web servers and pull / post data from them.

Some examples are an http client and a basic client/server messaging system

Have a look at https://bitbucket.org/jmls/dotrsocket  to grab the sourcecode. All comments, fixes and updates are welcomed as usual.

licenced under MIT, so there are no restrictions on use in either commercial or personal projects.

All Replies

Posted by Lieven De Foor on 09-May-2014 02:32

I'm working on a similar thing in my (limited) spare time that I'm planning to release as open source (EPL licence). I'll have a look, thanks!

Posted by jmls on 09-May-2014 02:42

let me know what's missing, and I'll add it in. https / chunking both seem to work which is a cool thing ;)

Posted by Marian Edu on 09-May-2014 02:58

yep, chunking is nice... next go for persistent connection (default in http1.1), maybe automatic follow on redirect, cookies, gzip encoding

love the comment on 32k raw variable ;)

Posted by jmls on 09-May-2014 03:00

unfortunately I can't claim credit for the comment. That was another
contributor. I chuckled as well ;)


On 9 May 2014 08:58, Marian Edu wrote:
> RE: http socket classes
> Reply by Marian Edu
>
> yep, chunking is nice... next go for persistent connection (default in
> http1.1), maybe automatic follow on redirect, cookies, gzip encoding
>
> love the comment on 32k raw variable ;)
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.



--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com

"The bitterness of poor quality remains long after the sweetness of
low price is forgotten”

Follow dot.r on http://twitter.com/DotRlimited

Posted by Stefan Drissen on 09-May-2014 03:20

The hexToInt made me cringe, have a newer one:

FUNCTION HexToInt RETURNS INTEGER ( i_chex AS CHARACTER ):

   DEF VAR iresult   AS INT NO-UNDO.
   DEF VAR chex      AS CHAR NO-UNDO.
   DEF VAR rhex      AS RAW NO-UNDO.    
   DEF VAR ii        AS INT  NO-UNDO.

   chex = TRIM( i_chex ).
   IF LENGTH( chex ) MODULO 2 = 1 THEN
      chex = "0":u + chex.
   rhex = HEX-DECODE( chex ).

   DO ii = 1 TO LENGTH( rhex ).

      ASSIGN
         iresult = iresult * 256
         iresult = iresult + GET-BYTE( rhex, ii )
         .

   END.

   RETURN iresult.

END FUNCTION.

MESSAGE HexToInt( "1180C" ) VIEW-AS ALERT-BOX.


Posted by Marian Edu on 09-May-2014 03:23

yep, that's why I try not to release much of my code lately... it's full
of lines like that ;)

do have my own version for a rest client used on exchange/sharepoint
integration (or even wcf web-services with ws-security) but would rather
not let anyone know when I'm screwed :)


[collapse]On 05/09/2014 11:01 AM, jmls wrote:
>[collapse] From: jmls
> Post: Re: http socket classes
> Posted in: OpenEdge Development
> Link: http://community.progress.com/technicalusers/f/19/p/10072/37936.aspx#37936
>
> unfortunately I can't claim credit for the comment. That was another
> contributor. I chuckled as well ;)
>
>
> On 9 May 2014 08:58, Marian Eduwrote:
>> RE: http socket classes
>> Reply by Marian Edu
>>
>> yep, chunking is nice... next go for persistent connection (default in
>> http1.1), maybe automatic follow on redirect, cookies, gzip encoding
>>
>> love the comment on 32k raw variable ;)
>>
>> Stop receiving emails on this subject.
>>
>> Flag this post as spam/abuse.
>
>


--
m.edu
keep it simple
http://www.ganimede.ro
http://ro.linkedin.com/in/marianedu
medu@ganimede.ro
mobile: +40 740 036 212
skype: marian.edu[/collapse][/collapse]

Posted by jmls on 09-May-2014 03:25

that's great , thanks very much. Could someone confirm that hex-decode is available for v10.2B ?

Posted by Stefan Drissen on 09-May-2014 03:29

hex-decode is available in 10.1C

Posted by jmls on 09-May-2014 03:32

many thanks Stefan. the updated code has been pushed to the repository. That has to be the fasted contribution to an open source ABL project ever ;)

Posted by jmls on 09-May-2014 03:49

@marian - yeah, this code is relatively old - so there's stuff in there that I am embarrassed about. ;) However, I have swallowed my pride, exposed the code to ridicule and will defend myself with the line "I was young and naive once .."

Posted by Bill Wood on 09-May-2014 06:21

Just for completeness, I notice that there is another implementation on github, by James Bowen -- this is also an MIT License.

github.com/.../ABL-HTTP-Web-Request

Posted by jmls on 09-May-2014 06:37

so, this highlights my beef with Progress ... there are at least 4 *open source* implementations of a http socket client. Each of which has taken a huge amount of time and effort (and code manipulating with memory pointers!) to write.

How many wasted hours/days/weeks have been spent of commercial and open source implementations of this client ?

This is because the 4GL that we use doesn't have an http client of it's own. It's 2014 - the ABL is meant to shield us from such concerns.

I want to write business programs that differentiate my company from my competitors. As do they ! But if we are spending time writing the very basic plumbing of network connectivity (which doesn't have any business advantage) then we are not spending the time writing the differentiators.

Please Progress - give us the tools to write the best apps in the world. I don't want to write c -style code to access the database - so I use Progress. I also don't want to write c-style code to glue things together. But right now you are making me !

Posted by Brian K. Maher on 09-May-2014 06:46

 
Hi jmls,
 
Please submit an enhancement request to the Ideas section.  I have brought this up to development before and there hasn't been enough customer push for it to give it traction.
 
Brian

Posted by Bill Wood on 09-May-2014 06:59

You don't need to create it...  there is already one there at:

community.progress.com/.../rest_outbound_support_should_be_in_the_abl.aspx

10 votes so far!

Posted by Brian K. Maher on 09-May-2014 07:05

 
Bill,
 
Would that work when you don't specifically want to use REST but you still want to do something like post a file to some site?
 
Brian

Posted by Marian Edu on 09-May-2014 07:15

nice, cookies, basic auth, follow-redirects and proxy... no support for
persistent connections but there is multipart/ford-data support that
will save me some work :)


[collapse]On 05/09/2014 02:21 PM, Bill Wood wrote:
>[collapse] From: Bill Wood
> Post: RE: http socket classes
> Posted in: OpenEdge Development
> Link: http://community.progress.com/technicalusers/f/19/p/10072/37964.aspx#37964
>
> Just for completeness, I notice that there is another implementation on github, by James Bowen -- this is also an MIT License.
> github.com/.../ABL-HTTP-Web-Request
>
>
> --
> You were sent this email because you opted to receive email notifications when someone created a new thread.
>
> To unsubscribe[collapse] from:
> - ...only this thread, disable notifications at http://community.progress.com/technicalusers/f/19/p/10072/37964.aspx#37964.
> - ...all email notifications from Progress Community, navigate to "Settings", click on the "Email" tab, then under the "Email Configuration" section, set Send Notifications to "No".
>
>


--
m.edu
keep it simple
http://www.ganimede.ro
http://ro.linkedin.com/in/marianedu
medu@ganimede.ro
mobile: +40 740 036 212
skype: marian.edu[/collapse][/collapse][/collapse]

Posted by Bill Wood on 09-May-2014 07:28

Sorry, I have lost context in this thread.   

If this refers to the link to github I posted, I do not really know.  I was just adding it as a reference.

If this refers to possible OpenEdge plans, generally I would expect to see a basic HTTP 1.1 implementation that is accessible as such, and the application/json REST interface would be a specialization of those classes.  (but that is just the musing of the architect in me).

Posted by Brian K. Maher on 09-May-2014 07:33

 
Bill,
 
> If this refers to possible OpenEdge plans, generally I would expect to see a basic HTTP 1.1 implementation that is accessible as such, and
> the application/json REST interface would be a specialization of those classes.  (but that is just the musing of the architect in me).
 
The above is what I was referring to.
 
Thanks, Brian
 

Posted by Marian Edu on 09-May-2014 07:35

as most things gets implemented as classes now maybe it's time for a
sdk... psc could drive, make the source open and get contributors

[collapse]On 05/09/2014 02:37 PM, jmls wrote:
>[collapse] From: jmls
> Post: RE: http socket classes
> Posted in: OpenEdge Development
> Link: http://community.progress.com/technicalusers/f/19/p/10072/37966.aspx#37966
>
> so, this highlights my beef with Progress ... there are at least 4 *open source* implementations of a http socket client. Each of which has taken a huge amount of time and effort (and code manipulating with memory pointers!) to write.
> How many wasted hours/days/weeks have been spent of commercial and open source implementations of this client ?
> This is because the 4GL that we use doesn't have an http client of it's own. It's 2014 - the ABL is meant to shield us from such concerns.
> I want to write business programs that differentiate my company from my competitors. As do they ! But if we are spending time writing the very basic plumbing of network connectivity (which doesn't have any business advantage) then we are not spending the time writing the differentiators.
> Please Progress - give us the tools to write the best apps in the world. I don't want to write c -style code to access the database - so I use Progress. I also don't want to write c-style code to glue things together. But right now you are making me !
>
>
> --
> You were sent this email because you opted to receive email notifications when someone created a new thread.
>
> To unsubscribe[collapse] from:
> - ...only this thread, disable notifications at http://community.progress.com/technicalusers/f/19/p/10072/37966.aspx#37966.
> - ...all email notifications from Progress Community, navigate to "Settings", click on the "Email" tab, then under the "Email Configuration" section, set Send Notifications to "No".
>
>


--
m.edu
keep it simple
http://www.ganimede.ro
http://ro.linkedin.com/in/marianedu
medu@ganimede.ro
mobile: +40 740 036 212
skype: marian.edu[/collapse][/collapse][/collapse]

Posted by jmls on 09-May-2014 07:40

+1

On 9 May 2014 13:36, Marian Edu wrote:
> Re: http socket classes
> Reply by Marian Edu
> as most things gets implemented as classes now maybe it's time for a
> sdk... psc could drive, make the source open and get contributors
>
> [collapse]On 05/09/2014 02:37 PM, jmls wrote:
>>[collapse] From: jmls
>> Post: RE: http socket classes
>> Posted in: OpenEdge Development
>> Link:
>> http://community.progress.com/technicalusers/f/19/p/10072/37966.aspx#37966
>>
>> so, this highlights my beef with Progress ... there are at least 4 *open
>> source* implementations of a http socket client. Each of which has taken a
>> huge amount of time and effort (and code manipulating with memory pointers!)
>> to write.
>> How many wasted hours/days/weeks have been spent of commercial and open
>> source implementations of this client ?
>> This is because the 4GL that we use doesn't have an http client of it's
>> own. It's 2014 - the ABL is meant to shield us from such concerns.
>> I want to write business programs that differentiate my company from my
>> competitors. As do they ! But if we are spending time writing the very basic
>> plumbing of network connectivity (which doesn't have any business advantage)
>> then we are not spending the time writing the differentiators.
>> Please Progress - give us the tools to write the best apps in the world. I
>> don't want to write c -style code to access the database - so I use
>> Progress. I also don't want to write c-style code to glue things together.
>> But right now you are making me !
>>
>>
>> --
>> You were sent this email because you opted to receive email notifications
>> when someone created a new thread.
>>
>> To unsubscribe[collapse] from:
>> - ...only this thread, disable notifications at
>> http://community.progress.com/technicalusers/f/19/p/10072/37966.aspx#37966.
>> - ...all email notifications from Progress Community, navigate to
>> "Settings", click on the "Email" tab, then under the "Email Configuration"
>> section, set Send Notifications to "No".
>>
>>
>
>
> --
> m.edu
> keep it simple
> http://www.ganimede.ro
> http://ro.linkedin.com/in/marianedu
> medu@ganimede.ro
> mobile: +40 740 036 212
> skype: marian.edu
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.



--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com

"The bitterness of poor quality remains long after the sweetness of
low price is forgotten”

Follow dot.r on http://twitter.com/DotRlimited[/collapse][/collapse][/collapse]

This thread is closed