Many years ago I wrote an RPGLE socket program using Scott Klement's socket tutorial. It worked out well once I figured out what I was doing.
Years have passed and I'm certain each time I sleep knowledge drains out my ears.
I am starting a new project for a third party connection. The IT staff was talking about doing ODBC connections with Data Queues for communications. The third party people commented about some clients using sockets so I asked why we don't just do sockets? The response was that they are too complicated. Since I had done it a few years ago I got volunteered.
This communication will occur between machines within our internal network.
Here's my questions.
Is a socket better than ODBC?
Is the best method for a socket program to go through Scott's tutorial again?
I'm going through the tutorial fairly quick since I've done this in a past life but I keep wondering if there is an updated way to do this since I'm reading a ten year old tutorial. :)
Pinned topic Socket Program - Scott's Tutorial
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-09-26T20:38:20Z at 2012-09-26T20:38:20Z by SystemAdmin
scott_klement 2700007QFX265 Posts
Re: Socket Program - Scott's Tutorial2012-09-26T20:25:02ZThis is the accepted answer. This is the accepted answer.All TCP/IP communication is done with sockets. There is no choice about whether to use them or not if you're communicating over a network, you're going to use them.
Here's how I view it: What you are really asking (or should be) is whether to use socket code that someone else wrote, or whether to write it yourself.
When you use data queues from another machine, there's a data queue API that uses sockets to send the data over the network. You don't have to write it, someone else (probably IBM) has already written this for you. But, the sockets are still being used.
Likewise, when you use ODBC over a network, the ODBC driver is using sockets to communicate with the server. So, again, your question is really whether or not to call code written by someone else (IBM or HiT or whomever wrote the ODBC driver) vs writing your own socket comms directly.
The advantage to ODBC is that it does extra work for you. It doesn't just create a raw socket, but it provides full access to your database, without you having to write a complex database driver. You're using one that someone else wrote.
On the other hand, if you aren't accessing a database, but just using ODBC as a way to communicate with another program, you may find that sockets code performs much better and requires less overhead, because ODBC is adding a lot of extra overhead snd other stuff you don't need.
Data queues are a fine tool. But, they're designed for IBM systems. Try connecting to a data queue from your iPhone, or from a PC running FreeBSD, etc. It doesn't work so well. They also add a bit of overhead (Though not nearly as much) over and above a simple call with sockets.
It makes sense to use existing pre-written code when it's available because it makes programmers more productive. But, if there isn't an applicable pre-written program, or if it doesn't do exactly what you want, or runs too slow, or whatever, knowing how to code to the lower-level API is very useful.
But, ultimately, the decision of which thing makes more sense in your particular project is something that you have to answer....
SystemAdmin 110000D4XK535 Posts
Re: Socket Program - Scott's Tutorial2012-09-26T20:38:20ZThis is the accepted answer. This is the accepted answer.
- scott_klement 2700007QFX
Since this other server will be requesting bits of data from more than one table I feel comfortable that writing my own socket program will work out best.
I am confident that with the tools I have because of your tutorial I'll get it done.