OpenTransport?

funkaster
Unregistered
 
Post: #1
I¥m trying to make a really simple server (listen for connections, receive a string). I usually do all this kind of stuff using BSD sockets, but now I need OS 9 compatibility (actually I¥m using CW Pro 7) and I¥m having a really hard time trying to make my server work using OT.
I¥ve read all the documentation (not really a help) but I think that maybe some code with a really simple server would help (one thread only, synchronous calls)... Actuallly if I¥m thinking in dropping the OS 9 compatibility, but I can¥t, because I don¥t have a OS X and I think it¥s not possible to use BSD sockets with CW Pro 7... (in Mac OS 9)
Any tips?
Quote this message in a reply
Member
Posts: 204
Joined: 2002.09
Post: #2
OpenTransport is a pain in the butt. If you're thinking of dropping OS 9 support in the near future, do not even attempt to wade through the stinking morass of OT. You'll save yourself weeks of pointless frustration.

But, if OS 9 support is critical, there is a bunch of small, synchronous sample code on Apple's developer website. An alternative would be to check out The Belt's source code (uDevGame 2002 entry, may need to wait until the downloads section comes back online), it wrappers OpenTransport and WinSock to support networking in OS 9, OS X, and Windows. Another source to look at , if nothing else.

Cheers,
Rocco
Quote this message in a reply
Member
Posts: 116
Joined: 2002.04
Post: #3
KittyMac Wrote:OpenTransport is a pain in the butt. If you're thinking of dropping OS 9 support in the near future, do not even attempt to wade through the stinking morass of OT. You'll save yourself weeks of pointless frustration.

From an API standpoint, OT is not signficantly more difficult than sockets. In fact, the API almost exactly matches sockets with just a few differences in naming. The only major difference is there is no select call, so usually synchronous/blocking mode is used, but in some circumstances, you may need to use async mode or polling.

If you can write sockets code, you can write OT without major difficulty.

With that said, the best option for the poster might be to use sockets on OS X and GUSI on OS 9 (which provides a sockets implementation).

Wade
Quote this message in a reply
funkaster
Unregistered
 
Post: #4
wadesworld Wrote:From an API standpoint, OT is not signficantly more difficult than sockets. In fact, the API almost exactly matches sockets with just a few differences in naming. The only major difference is there is no select call, so usually synchronous/blocking mode is used, but in some circumstances, you may need to use async mode or polling.

If you can write sockets code, you can write OT without major difficulty.

Wade

well, they have similarities (both of them are APIs to do network stuff), but from my point of view BSD sockets are much cleaner, and of course, with a wider range of documentation.
Quote this message in a reply
Member
Posts: 116
Joined: 2002.04
Post: #5
Well, cleaner in the respect that you have select().

But really - look closely - they're nearly identical.

In sockets, you call socket() to create a new socket. In OT, you call OTOpenEndpointInContext(). In sockets to send, you call connect or accept. In OT you call OTConnect or OTAccept.

In short, you can take a huge portion of the knowledge you have about sockets and apply it to OT.

My point is simply that OT is not nearly as bad as people make it out to be - it's not hugely different from sockets. Many of the difficult issues on OT are the same difficult issues you deal with with sockets.

But if you're writing code on OS X that is OS X only, the clear choice is sockets.

Wade
Quote this message in a reply
funkaster
Unregistered
 
Post: #6
wadesworld Wrote:Well, cleaner in the respect that you have select().

But really - look closely - they're nearly identical.
Wade

They are similar (both are network apis), what I mean with cleaner is that sockets are FDs, this make it more comfortable to work with, you can use almost all the stdio functions to read/write to a socket (read(), write(), etc. just like a plain FD), that's what I like about sockets.
Quote this message in a reply
Post Reply