Building an app for both 16bit and 32bit TCPIP stacks - OS2

This is a discussion on Building an app for both 16bit and 32bit TCPIP stacks - OS2 ; Hello, Is it possible to build an application for both the old 16 bit (pre v4.1) and newer 32bit TCPIP stacks. I am currently using GCC v3.3.5. How do I programmaticallly test for the TCPIP version? -- jmm (hyphen) list ...

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 20 of 42

Thread: Building an app for both 16bit and 32bit TCPIP stacks

  1. Building an app for both 16bit and 32bit TCPIP stacks

    Hello,
    Is it possible to build an application for both the old 16 bit (pre
    v4.1) and newer 32bit TCPIP stacks. I am currently using GCC v3.3.5.
    How do I programmaticallly test for the TCPIP version?

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)

  2. Re: Building an app for both 16bit and 32bit TCPIP stacks

    Hi,

    you can write an app that automatically makes use of the 16-bit or the
    32-bit stack, whatever is installed WITHOUT any change to your app or
    runtime checks. The only thing you need to do is restrict yourself to
    the "old" BSD 4.3 API and not the latest "new" BSD 4.4 API (but unless
    you are doing fancy stuff, that is not too much of a restriction).
    The BSD 4.3 compliant API was described in the "old" TCP/IP Programming
    reference (if you need it, I can get it to you, unfortunately the file
    is also named tcppr.inf, see below), the TCP/IP Version 3.0 Programmer's
    toolkit contained that documentation.
    Note: the new BSD 4.4 compliant API is ONLY available with the 32-bit
    TCP/IP stack.

    You will have to do this if you are using the latest OS/2 toolkit:
    1.) specify #define TCPV40HDRS before inclusion of any TCP/IP header file
    2.) link with import libraries tcp32dll.lib and so32dll.lib and NOT with
    tcpip32.lib. The trick is that on a system with 16-bit stack,
    tcp32dll.dll and so32dll.dll contain REAL routines (thunking to 16-bit
    code) whereas on a system with a 32-bit stack, these dll only contain
    forwarders to tcpip32.dll which in turn contains the REAL (32-bit code)
    routines (that's why your app can then run without change).

    To understand, have a look at the "new" TCP/IP Programming reference
    (tcppr.inf that comes with the latest OS/2 toolkit)
    under "Introduction to Networking Services".


    Lars


    Jim Moe schrieb:
    > Hello,
    > Is it possible to build an application for both the old 16 bit (pre
    > v4.1) and newer 32bit TCPIP stacks. I am currently using GCC v3.3.5.
    > How do I programmaticallly test for the TCPIP version?
    >


  3. Re: Building an app for both 16bit and 32bit TCPIP stacks

    You can also find the "old" TCP/IP API (BSD 4.3 compliant) documentation
    online at this place:

    http://www.warpspeed.com.au/cgi-bin/...40\TCPPR.INF+0

    Regards,
    Lars

    Lars Erdmann schrieb:
    > Hi,
    >
    > you can write an app that automatically makes use of the 16-bit or the
    > 32-bit stack, whatever is installed WITHOUT any change to your app or
    > runtime checks. The only thing you need to do is restrict yourself to
    > the "old" BSD 4.3 API and not the latest "new" BSD 4.4 API (but unless
    > you are doing fancy stuff, that is not too much of a restriction).
    > The BSD 4.3 compliant API was described in the "old" TCP/IP Programming
    > reference (if you need it, I can get it to you, unfortunately the file
    > is also named tcppr.inf, see below), the TCP/IP Version 3.0 Programmer's
    > toolkit contained that documentation.
    > Note: the new BSD 4.4 compliant API is ONLY available with the 32-bit
    > TCP/IP stack.
    >
    > You will have to do this if you are using the latest OS/2 toolkit:
    > 1.) specify #define TCPV40HDRS before inclusion of any TCP/IP header file
    > 2.) link with import libraries tcp32dll.lib and so32dll.lib and NOT with
    > tcpip32.lib. The trick is that on a system with 16-bit stack,
    > tcp32dll.dll and so32dll.dll contain REAL routines (thunking to 16-bit
    > code) whereas on a system with a 32-bit stack, these dll only contain
    > forwarders to tcpip32.dll which in turn contains the REAL (32-bit code)
    > routines (that's why your app can then run without change).
    >
    > To understand, have a look at the "new" TCP/IP Programming reference
    > (tcppr.inf that comes with the latest OS/2 toolkit)
    > under "Introduction to Networking Services".
    >
    >
    > Lars
    >
    >
    > Jim Moe schrieb:
    >> Hello,
    >> Is it possible to build an application for both the old 16 bit (pre
    >> v4.1) and newer 32bit TCPIP stacks. I am currently using GCC v3.3.5.
    >> How do I programmaticallly test for the TCPIP version?
    >>


  4. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Wed, 07 Nov 2007 15:06:31 -0700, Jim Moe
    wrote:

    > Is it possible to build an application for both the old 16 bit (pre
    > v4.1) and newer 32bit TCPIP stacks. I am currently using GCC v3.3.5.


    Depending on which functions you use, you can either write a DLL to convert
    the app's 32 bit calls to their 16 bit equivalent (I implemented this for a
    limited set of functions but never really got round to finishing it) or you
    can query the various entrypoints in the various DLLs dynamically and call
    them as and when.

    > How do I programmaticallly test for the TCPIP version?


    This worked for me when I wrote my REXX library which includes a function
    for querying sockets:

    char buffer[100];

    sock_init();
    if ((getinetversion(buffer) != -1) && (*buffer > '4'))
    printf("32\n");
    else
    printf("16\n");

  5. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On 11/07/07 06:30 pm, Lars Erdmann wrote:
    >
    > The BSD 4.3 compliant API was described in the "old" TCP/IP Programming
    > reference (if you need it, I can get it to you, unfortunately the file
    > is also named tcppr.inf, see below), the TCP/IP Version 3.0 Programmer's
    > toolkit contained that documentation.
    >

    Yes, I would appreciate that.
    I have the 4.2 API Programming Reference already.

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)

  6. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Thu, 8 Nov 2007 01:30:35 UTC, Lars Erdmann
    wrote:

    > You will have to do this if you are using the latest OS/2 toolkit


    AFAIK, GCC 3.x together with Knut's LIBC offers a way to build
    TCP/IP apps without using the OS/2 toolkit. While this simplifies
    porting Unix apps, the downside is that result of this approach
    will always require the 32bit IP-stack.


    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


  7. Re: Building an app for both 16bit and 32bit TCPIP stacks

    [A complimentary Cc of this posting was sent to
    Ruediger Ihle
    ], who wrote in article :
    > > You will have to do this if you are using the latest OS/2 toolkit

    >
    > AFAIK, GCC 3.x together with Knut's LIBC offers a way to build
    > TCP/IP apps without using the OS/2 toolkit.


    Same with EMX.

    > While this simplifies porting Unix apps, the downside is that result
    > of this approach will always require the 32bit IP-stack.


    EMX does not require any particular stack. Are you SURE that
    gcc3-CRTL applications require 32-bit stack?

    Yours,
    Ilya

  8. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Sun, 11 Nov 2007 08:29:29 UTC, Ilya Zakharevich
    wrote:

    > EMX does not require any particular stack. Are you SURE that
    > gcc3-CRTL applications require 32-bit stack?


    At least it was the case a year ago. Not sure if it has changed
    meanwhile.

    As for EMX: It was designed for the 16bit stack and the 32bit
    stack does provide backward compatibility. That's why there is
    no dependency on the TCP/IP version.



    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


  9. Re: Building an app for both 16bit and 32bit TCPIP stacks

    [A complimentary Cc of this posting was sent to
    Ruediger Ihle
    ], who wrote in article :
    > > EMX does not require any particular stack. Are you SURE that
    > > gcc3-CRTL applications require 32-bit stack?


    > At least it was the case a year ago. Not sure if it has changed
    > meanwhile.


    I think I used firefox with Warp3 (but can't be sure; I switched to
    warp4 a couple of years ago).

    > As for EMX: It was designed for the 16bit stack and the 32bit
    > stack does provide backward compatibility. That's why there is
    > no dependency on the TCP/IP version.


    That's, IMO, a broken logic. EMX is a well-designed system.
    Well-designed systems allow for graceful degradation: unless 32-bit
    stack is REQUIRED for some operation, they would be able to use 16-bit
    one (probably, with "higher probability" of bugs etc).

    [While gcc3-libc is, IMO, designed like a toy.]

    Yours,
    Ilya

  10. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Sun, 11 Nov 2007 11:16:43 UTC, Ilya Zakharevich
    wrote:


    > I think I used firefox with Warp3 (but can't be sure; I switched to
    > warp4 a couple of years ago).


    Mozilla isn't using the approach described. AFAIK, they have their
    TCP/IP primitives encapsulated in NSPR4.DLL and they are using the
    toolkit to build this DLL. Remember, there used to be a Mozilla
    version compiled with an IBM compiler, which doesn't offer TCP/IP
    as part of it's CRTL at all.

    But many of these newly created OS/2 ports (like MPlayer, KMP, Gnash,
    Valknut, Psi, Curl and even the newer versions of WarpVision) will not
    run anymore on older systems due to this issue.



    > That's, IMO, a broken logic. EMX is a well-designed system.
    > Well-designed systems allow for graceful degradation: unless 32-bit
    > stack is REQUIRED for some operation, they would be able to use 16-bit
    > one (probably, with "higher probability" of bugs etc).


    When EMX was created there was no such thing like a 32bit TCP/IP stack.
    Well-designed or not, they simply had no other choice than using what
    was available at that time. And that was 16bit TCP/IP. As Lars
    described,
    IBM implemented a (small) compatibility layer so that old applications
    (in this case applications built with EMX) could continue to run.
    So this is not an example of "good design" on the EMX side versus "toy"
    on the GCC side. It's just conincidence.


    The newer GCCs as well as OpenWatcom only implementented access to the
    32bit stack in the first place. Why ? Most likely because it was easier
    to achieve compatibility with recent Unix source code.
    Not that I like that apporach (most of my OS/2 installations are
    W4/FP15),
    but that's the way it is. I think it's more a question of manpower and
    of
    priorities, than a design question.



    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


  11. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On 2007-11-11, Ruediger Ihle wrote:

    > AFAIK, GCC 3.x together with Knut's LIBC offers a way to build
    > TCP/IP apps without using the OS/2 toolkit. While this simplifies
    > porting Unix apps, the downside is that result of this approach
    > will always require the 32bit IP-stack.


    By default but not always. There is a documented way to use the
    old IP-stack. You have to define TCPV40HDRS and add this line

    call EnvAddFront fRM, 'LIBRARY_PATH', sGCCForw'/lib/tcpipv4'

    to
    gccenv.cmd

    Franz

  12. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Sun, 11 Nov 2007 12:56:27 +0000 (UTC), Ruediger Ihle
    wrote:

    > But many of these newly created OS/2 ports (like MPlayer, KMP, Gnash,
    > Valknut, Psi, Curl and even the newer versions of WarpVision) will not
    > run anymore on older systems due to this issue.


    I now have the latest Mplayer running on Warp 4's so called 16 bit stack
    using my TCPIP32.DLL interface forwarder.

  13. Re: Building an app for both 16bit and 32bit TCPIP stacks

    [A complimentary Cc of this posting was sent to
    Ruediger Ihle
    ], who wrote in article :
    > > That's, IMO, a broken logic. EMX is a well-designed system.
    > > Well-designed systems allow for graceful degradation: unless 32-bit
    > > stack is REQUIRED for some operation, they would be able to use 16-bit
    > > one (probably, with "higher probability" of bugs etc).

    >
    > When EMX was created there was no such thing like a 32bit TCP/IP stack.
    > Well-designed or not, they simply had no other choice than using what
    > was available at that time. And that was 16bit TCP/IP. As Lars
    > described,
    > IBM implemented a (small) compatibility layer so that old applications
    > (in this case applications built with EMX) could continue to run.
    > So this is not an example of "good design" on the EMX side versus "toy"
    > on the GCC side. It's just conincidence.


    You may think it is a coincidence. Knowing how the EMX source code is
    done, I know that it is not - even if 32-bit stack was available, EMX
    would allow graceful degradation.

    > The newer GCCs as well as OpenWatcom only implementented access to the
    > 32bit stack in the first place. Why ? Most likely because it was easier
    > to achieve compatibility with recent Unix source code.
    > Not that I like that apporach (most of my OS/2 installations are
    > W4/FP15),
    > but that's the way it is. I think it's more a question of manpower and
    > of
    > priorities, than a design question.


    I know very little about design of gcc3. But all I see suggests it
    very strongly that it is clue-count, not design.

    Hope this helps,
    Ilya

  14. Re: Building an app for both 16bit and 32bit TCPIP stacks

    Hallo,

    "Ilya Zakharevich" schrieb im Newsbeitrag
    news:fh7ml3$1fln$1@agate.berkeley.edu...
    > [A complimentary Cc of this posting was sent to
    > Ruediger Ihle
    > ], who wrote in article
    > :
    >> > That's, IMO, a broken logic. EMX is a well-designed system.
    >> > Well-designed systems allow for graceful degradation: unless 32-bit
    >> > stack is REQUIRED for some operation, they would be able to use 16-bit
    >> > one (probably, with "higher probability" of bugs etc).

    >>
    >> When EMX was created there was no such thing like a 32bit TCP/IP stack.
    >> Well-designed or not, they simply had no other choice than using what
    >> was available at that time. And that was 16bit TCP/IP. As Lars
    >> described,
    >> IBM implemented a (small) compatibility layer so that old applications
    >> (in this case applications built with EMX) could continue to run.
    >> So this is not an example of "good design" on the EMX side versus "toy"
    >> on the GCC side. It's just conincidence.

    >
    > You may think it is a coincidence. Knowing how the EMX source code is
    > done, I know that it is not - even if 32-bit stack was available, EMX
    > would allow graceful degradation.


    I don't get your point at all. EMX is stone old (which does not mean that it
    is bad, I do not want to get into that discussion). At the time where EMX
    became available on OS/2 there only existed the BSD 4.3 compliant stack and
    that was realized as 16-bit code on OS/2 (wrapped with 32-bit wrappers as so
    much else of OS/2).
    It is "IBM OS/2 networking team" achievement (and not EMX's) that apps
    compiled for the old 16-bit BSD 4.3 complienat stack run unchanged on the
    new 32-bit BSD 4.4 compliant stack.

    Lars



  15. Re: Building an app for both 16bit and 32bit TCPIP stacks

    [A complimentary Cc of this posting was sent to
    Lars Erdmann
    ], who wrote in article <47379285$0$4361$9b4e6d93@newsspool4.arcor-online.net>:
    > I don't get your point at all. EMX is stone old (which does not mean that it
    > is bad, I do not want to get into that discussion). At the time where EMX
    > became available on OS/2 there only existed the BSD 4.3 compliant stack and
    > that was realized as 16-bit code on OS/2 (wrapped with 32-bit wrappers as so
    > much else of OS/2).


    > It is "IBM OS/2 networking team" achievement (and not EMX's) that apps
    > compiled for the old 16-bit BSD 4.3 complienat stack run unchanged on the
    > new 32-bit BSD 4.4 compliant stack.


    Sorry, but this is not so. EMX loads tcpip stuff dynamicaly at
    runtime, when needed. It would take about 10 lines of code to switch
    betweeen different implemenations.

    It takes approximately the same amount of code to handle what you call
    `"IBM OS/2 networking team" achievement' (so EMX can be COMPILED with
    any toolkit).

    Hope this helps,
    Ilya

  16. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Sun, 11 Nov 2007 13:28:37 UTC, Franz Bakan
    wrote:

    > By default but not always. There is a documented way to use the
    > old IP-stack. You have to define TCPV40HDRS and add this line
    >
    > ....
    >



    Ahh! So someone was listening to my complaints at Warpstock
    Europe 2006 ;-).

    I'm wondering, how many programmers know about this...


    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


  17. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Mon, 12 Nov 2007 01:47:23 UTC, Ilya Zakharevich
    wrote:

    > Sorry, but this is not so. EMX loads tcpip stuff dynamicaly at
    > runtime, when needed. It would take about 10 lines of code to switch
    > betweeen different implemenations.


    No, it wouldn't. If it was that easy, it would have been implemented
    in the first place. There are differences in the data structures
    (that's why we have different headers), that require a translation
    layer. This layer can only be done with 100% compatibility in the
    direction IBM did (i.e. the newer IP stack can emulate the old one).
    Any approach to do the opposite will only work partially. I guess,
    Paul Ratcliffe can comment on this.




    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


  18. Re: Building an app for both 16bit and 32bit TCPIP stacks

    [A complimentary Cc of this posting was sent to
    Ruediger Ihle
    ], who wrote in article :
    > On Mon, 12 Nov 2007 01:47:23 UTC, Ilya Zakharevich
    > wrote:
    >
    > > Sorry, but this is not so. EMX loads tcpip stuff dynamicaly at
    > > runtime, when needed. It would take about 10 lines of code to switch
    > > betweeen different implemenations.

    >
    > No, it wouldn't. If it was that easy, it would have been implemented
    > in the first place. There are differences in the data structures
    > (that's why we have different headers), that require a translation
    > layer. This layer can only be done with 100% compatibility in the
    > direction IBM did (i.e. the newer IP stack can emulate the old one).
    > Any approach to do the opposite will only work partially.


    I suspect you are confused. EMX maps POSIX API to "16-bit API" (and
    maps it more or less "trivially"). It would be trivial to map it to
    "32-bit API" too (if a translation level were not present; with
    translation level in place, even this trivial step is not needed).

    Hope this helps,
    Ilya

  19. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On 2007-11-12, Ruediger Ihle wrote:

    > Ahh! So someone was listening to my complaints at Warpstock
    > Europe 2006 ;-).


    no, unfortunately I never visited one of these warpstocks :-(
    I once got a request to recompile one of my ports (tesseract)
    for some 'old' Warp-Version...

    > I'm wondering, how many programmers know about this...


    IIRC that's documented since quite some time in the readme's of
    gcc335.

    Bye,
    Franz

  20. Re: Building an app for both 16bit and 32bit TCPIP stacks

    On Mon, 12 Nov 2007 09:29:38 UTC, Ilya Zakharevich
    wrote:

    > EMX maps POSIX API to "16-bit API" (and maps it more or less
    > "trivially").


    AFAIK, EMX uses a NetBSD-conform TCP/IP implementation, which
    happens to be of the same version level from which OS/2's 16bit
    IP-stack is derived from. That's why this mapping is so trivial.

    Now, in order not to just call OS/2's 32bit IP-stack (which is
    based on a newer BSD version), but to take advantage of new
    features, the EMX headers would have to be changed to BSD4.4
    (or so) level. Now the translation to the 32bit IP-stack would
    be as trivial, as it is now for the 16bit stack. But that doesn't
    help much. What we would need also is a runtime API translation
    from BSD4.4 to BSD4.3, in case the newer IP-stack is not available
    on a particular system. But a translation from the higher to the
    lower version level is not 100% doable without loosing something.
    And I'm not sure if that could be made transparent to the
    application.



    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


+ Reply to Thread
Page 1 of 3 1 2 3 LastLast