[C++] Emulator of POSIX Socket for Carbon and Classic

Andreas Grosam agrosam at computerworks.ch
Tue Mar 11 13:30:14 CST 2003


Hi Totte,


Yes, this is the right way.

Firstly, encapsulate the thread and socket stuff having one common API in order to be able to have some level of abstraction for the clients.

For a Server having no GUI this should be quit easy.
For clients which are a library which itself will be used in applications having a GUI this might be more complex, however.

Secondly, build two binaries:

a) CFM running on MacOS 9 only using GUSI for the underlaying implementation 

b) Mach-O running on MacOS X. In that case, there is no GUSI required since there is the native POSIX API.

However, there is one aspect which should be taken in acount:

- Carbon (and emulated POSIX over Carbon) does only have a cooperative thread model.
- the native POSIX has (only?) preemptive thread model.

So the clients - say the server - must have an architecture which is appropriate for BOTH models so that it works seamlessly with either the GUSI or the native POSIX implementation.

This could be achieved  - for instance - through compiler switches and Template techniques. However, it might require significant efforts in order to accomplish this.

Ideally, the client is completely independend on the thread model. Don´t know if this is possible at all. Sometimes it would be sufficient to place a Yield() occassionally. 

Totte: does your "tptest" framework also include a common thread API?


Andreas


On Dienstag, 11. März 2003, Totte Alm <totte at code66.se> wrote:
>
>måndagen den 10 mars 2003 kl 23.32 skrev Ruslan Zasukhin:
>
>> MacOS Classic and Carbon targets do not have support for POSIX Socket  
>> API.
>> Yes this is well known fact...
>>
>
>That is Carbon-CFM. Carbon-Macho on X do have it.
>
>For Classic/Carbon-CFM, there are two ways to go.
>(1) Use the GUSI as Andreas mentioned. Its a little overkill as I see  
>it, and nothing that complex (have you looked at the pseudocode its  
>written in??), will work "out of the box" without alot of
>hazzles.
>
>(2) Write the sockets stuff two layered, with a common layer on top,  
>and a plattform specific layer below.
>This was done for TPTest (network throughput test application for  
>Win32,Linux, Mac OSX Carbon, should work for Classic also, with some  
>modifications to the OT code) when we was involved porting it to the  
>mac.
>The full source, including the Network stuff is located at sourceforge:
>http://sourceforge.net/projects/tptest/
>
>// Totte
>
>
>
>>
>------------------------------------------------------------------------ 
>-----------------------
>The intelligence on the planet is constant,
>it's just the population that is growing.
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina
>




More information about the Valentina mailing list