Highlighted
Absent Member.
Absent Member.
585 views

[archive] Creating a Socket Listener

[Migrated content. Thread originally posted on 28 July 2004]

We are trying to get a COBOL program to listen to a socket on the network for incoming packets. The originator of the packets does not have the ability for two-way communication so we need to be able to simply listen to the correct port for that IP address and grab the data for use in the program. We though about using c$socket but it appears that it expects two-way communication which is not possible.

Does anyone have any suggestions?
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Creating a Socket Listener

What makes you believe it excepts two-ways communication?

See socksrv1.cbl in the sample directory.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Creating a Socket Listener

WFerrarra is right - the C$SOCKET library expects two-way communication to be possible - this is because it uses TCP connections, which do verification of all sent packets. What you need is to use a UDP connection. There is not an easy way to do that (none using the standard ACUCOBOL-GT libraries). My only suggestion is to either 1) request an enhancement or 2) link some C code into the runtime. Note that depending on the OS you are using, you may be able to get away with loading DLLs and/or shared libraries and making the socket calls directly.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Creating a Socket Listener

I was originally toying with the idea of creating a mid-layer C or Perl script that would get the data from the socket and cat it out to a file that the AcuCOBOL program would read for processing. The only problem is that we don't really have any C or Perl technical expertise on-site so thats why we were looking to be able to use the c$socket.

Does anyone happen to know where I can find some open source C or Perl that I'd be able to use with very little modification to do the socket reads?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.