• Subject: Re: TCP/IP sockets - Getservbyname
  • From: Patrick Townsend <townsend@xxxxxxxxxxxxxx>
  • Date: Thu, 22 Jul 1999 21:19:21 -0700
  • CC: "'RPG400 Help (E-mail)'" <RPG400-L@xxxxxxxxxxxx>
  • Organization: Patrick Townsend & Associates, Inc.

Chris,

getservbyname() returns a servent structure. The servent structure is
defined in the NETDB member in the header file H in library QSYSINC. The
first entry in the list is a pointer to the service name. The second
entry is a pointer to a list of aliases. The third entry is an integer
of the port number. The last entry is the protocol ("tcp", "upd", etc.).

Patrick

Chris Bipes wrote:
> 
> I am trying to add the ability to look up a service name using the
> Getservbyname function provided in TCO/IP Sockets.  I am using RPGLE under
> V3R7.  I suppose I could just open the file qusrsys/qatocls1 and chain to
> receive but that would be cheating.... Has any one else attempted this feat?
> 
> Here is what I have achieved so far:
> 
> 1. The function is working and returning the pointer.  The file is pointing
> to the correct record, (wrkjob open files rrn while in debug).
> 
> 2. I have defined the structure to be a 200 character field based on the
> returned pointer.  The field though seem to have garbage in it.  See
> following:
> 
>  00000     80000000 00000000 F0ABF1E1 1900E600   - Ø.......0¿1÷..W.
>  00010     80000000 00000000 F0ABF1E1 1900E650   - Ø.......0¿1÷..W&
>  00020     0000A41C 00000000 00000000 00000000   - ..u.............
>  00030     80000000 00000000 F0ABF1E1 1900E621   - Ø.......0¿1÷..W.
>  00040     96856081 A4A38800 40404040 40404040   - oe-auth.
>  00050     40404040 40404040 40404040 40404040   -
>  00060     00A38397 00404040 40404040 40404040   - .TCP.
>  00070     40404040 40404040 40404040 40404040   -
>  00080     40000000 00000000 00000000 00000000   -  ...............
>  00090     80000000 00000000 F0ABF1E1 1900E6A0   - Ø.......0¿1÷..Wµ
>  000A0     80000000 00000000 F0ABF1E1 1900E6C1   - Ø.......0¿1÷..WA
>  000B0     80000000 00000000 F0ABF1E1 1900E6E2   - Ø.......0¿1÷..WS
>  000C0     00000000 00000000 00000000 00000000   - ................
> 
> The service name is "oe-auth" and protocol = "tcp".  I have highlight them.
> The port number = 42012 or A41C which I also highlighted.  There are several
> aliases that do not show up in the 200 byte string but are further down the
> line.  Now for the question, is this function returning pointers or the
> values?  It looks like F0ABF1E11900E600 might be a pointer to the data.
> The pointer returned is SPP:F0ABF1E11900E5C0
> 
> Can one of you "C" programmers tell this RPGer what I am getting?  How to
> use this function?
> What I am doing wrong?
> 
> Thanks in advance,
> 
> Christopher K. Bipes            mailto:ChrisB@Cross-Check.com
> Sr. Programmer/Analyst          mailto:Chris_Bipes@Yahoo.com
> CrossCheck, Inc.                http://www.cross-check.com
> 6119 State Farm Drive           Phone: 707 586-0551 x 1102
> Rohnert Park  CA  94928 Fax: 707 586-1884
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---

-- 
IBM AS/400 communications, FTP automation, and network security
software and consulting services.

http://www.patownsend.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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