ca.portal.admin

Re:Re: TCP/IP generic listener server

Discussion created by ca.portal.admin on Feb 21, 2006
Hi Onni,

I've tried the ACCEPT call, but when this is called, the
program to
goes in WAIT state.
I'm programming using COBOL option under VSE/ESA, the function ACCEPT is
sopported
under this environment.

Thank you,

Naval Espasa
Barcelona Stock Exchange


----- Original Message -----
From: ""Onni Kukkonen"" <onni.kukkonen@VEGASOFT.COM>
To: <IDMS-L@LISTSERV.IUASSN.COM>
Sent: Tuesday, February 21, 2006 12:33 PM
Subject: Re: TCP/IP generic listener server

Hi,

The ACCEPT call of Socket API should return the IP address as a part
of
sockaddr argument.

Onni Kukkonen
Vegasoft

-----Original Message-----
From: IDMS 3rd-party providers forum
[mailTo:IDMSVENDOR-L@LISTSERV.IUASSN.COM] On Behalf Of Naval Espasa
Sent: Tuesday, February 21, 2006 12:05 PM
To: IDMSVENDOR-L@LISTSERV.IUASSN.COM
Subject: TCP/IP generic listener server

Hi ALL,

I'm programming a TCP/IP generic listener server in COBOL. It
=
works pretty well,
but I need to get the remote host Ip address, and I don't know how get
=
it.

Has anyone else had this problem?

I'm in VSE/ESA V2R6 and IDMS R16 SP3

Thanks,

=20

Naval Espasa
Barcelona Stock Exchange
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP








Normal

Normal
Re: TCP/IP generic listener server
"I have a mainline in my Cobol generic listener that does the following:

perform getPeerName
perform getDotAddress

Here's the working storage:

02 tcpNAME.
03 tcpFAMILY pic s9(4) comp value 0.
03 tcpPORT pic 9(4) comp value 0.
03 tcpADDRESS pic s9(8) comp value 0.
03 tcpRESV pic x(8) value low-values.
02 request.
03 requestCode pic s9(8) comp value 0.
03 requestReturn pic s9(8) comp value 0.

The two performed sections follow - I had no problems with this code - worked first time - I'm not aware that we had to apply any APAR's to Release 16.0 SP(1) for this to work - there is an APAR relating to a mix up in the translation of NL (new line) and LF (line feed) in the RHDCCODE tables - that caused confusion in other areas but this code worked fine.

HTH - cheers - Gary


getPeerName section.

if tcpTraceOn
display tcpProgram ' ""getPeerName"" '
end-if

move 0 to x
move 16 to wkLen
call IDMSOCKI using SOCKET-FUNCTION-GETPEERNAME,
SOCKET-RETCD, SOCKET-ERRNO, SOCKET-RSNCD, tcpS,
tcpName, wkLen
if SOCKET-RETCD NOT = 0
display tcpProgram ' INET_GetPeerName Failed'
move 'Could not identify Peer' to tcpMessage
perform tcpError
end-if
. exit.


******************************************************************
* Get IP Address in dotted string from Byte Address: *
* *
* tcpAddress = the byte address (input) *
* tcpDotAddress = dot form IP address (output) *
* x = returned string length (output) *
******************************************************************

getDotAddress section.

if tcpTraceOn
display tcpProgram ' ""getDotAddress"" '
end-if

move 0 to x
move 16 to wkLen
call IDMSOCKI using SOCKET-FUNCTION-INETNTOA, SOCKET-RETCD
SOCKET-ERRNO, SOCKET-RSNCD,
tcpAddress, tcpDotAddress, wkLen, x
if SOCKET-RETCD NOT = 0
display tcpProgram ' INET_N2A Failed'
move 'Invalid IP BYTE Address' to tcpMessage
perform tcpError
end-if

if tcpTraceOn
display tcpProgram ' DotAddress: ' tcpDotAddress
' Encoding: ' encoding
end-if
.
getDotAddressExit. exit.

Gary Cherlet
Justice Technology Services
Telephone +61 (0)8 8226 5199
Facsimile +61 (0)8 8226 5311
Mobile +61 (0)41 333 1613
MailTo:cherlet.gary@saugov.sa.gov.au

This e-mail message and any attachments are qualified as follows:
Addressing: If you have received this e-mail in error, please advise by reply e-mail to the sender. Please also destroy the original transmission and its contents.
Confidentiality: This e-mail may contain confidential information which also may be legally privileged. Only the intended recipient(s) may access, use, distribute or copy this e-mail.
Individual Views: Unless otherwise indicated, the views expressed are those of the sender, not Justice Technology Services.
Computer Viruses: It is the recipient's responsibility to check the e-mail and any attached files for viruses.

Outcomes