
About REALbasic
A rapid application development (RAD) environment that provides developers a marked increase in productivity over other cross-platform development tools. REALbasic includes drag-and-drop capability to enable you to quickly create a user interface design, then incorporate the code behind it to add power and functionality.
REALbasic is highly compatible with Visual Basic, so Visual Basic developers are productive very quickly with REALbasic. REALbasic also comes with a utility to help convert Visual Basic projects to REALbasic where they can be compiled for Windows, Mac, even Linux — with the click of a checkbox.
What’s New in this Version
- Bounds3D: LineIntersection and LineSegmentIntersection now work correctly in all cases; previously, they would return invalid results for some inputs.
- Code Editor: Find Next (as well as Replace & Find Next) now works correctly for search strings that are only one character long.
- Container Controls: No longer need to be moved before being properly parented.
- Many more enhancements. ![]()
INTRODUCTION
Background: This document describes the socket functionality in version 5.5 of REALbasic. It might not be correct for earlier versions, though we try to keep this document updated as of REALbasic version 5.0.
Prior to version 5.0, REALbasic supported only one socket protocol: TCP/IP. This is a connection-oriented protocol that has been an Internet standard for years. Then, with version 5.0, many new features and changes were implemented (including adding support for new protocols such as SSL and UDP). For version 5.5, there are many improvements to the existing socket functionality, as well as new features and a better underlying implementation for Mac OS X.
Note that the ServerSocket and the SSLSocket are Pro-Only features of REALbasic.
Synchronous vs Asynchronous Operation: In general, there are two modes of operation for a socket: synchronous and asynchronous. REALbasic sockets are always asynchronous (though synchronous operation can be simulated by the calling code).
Synchronous sockets operate under the assumption that once the socket call has been made, it will not return control to the calling program until after it has received some form of response. This means that either an error has occurred, or the function has completed. Example: if you say Socket1.Connect, control will not be given back to your program until the socket has connected, or it has determined there was an error with the connection process.
Synchronous sockets, while easy to program for, tend to be slow. This is because the majority of the time is spent in waiting for the socket instead of doing something useful, like queuing data to send once the connection is complete.
Asynchronous sockets return control back to the calling program immediately. The calling program will receive a notification via a callback function letting it know whether there was an error, or the function completed properly. To go back to the previous example, an asynchronous call to Socket1.Connect will return immediately, but you won’t know the outcome of the process until you receive a Socket.Connected event, or a Socket.Error event.
Asynchronous sockets tend to be faster than their synchronous counterparts because they give the calling program the control it needs to do other things, such as process user input, etc. This means your sockets will work faster. But there are some caveats you need to be aware of (see below).
Overhaul for 5.0: With REALbasic 5.0, sockets have gone through a major overhaul. The first major change was the introduction of a new base class, SocketCore, from which other socket classes inherit. This class handles the core functionality for the sockets that RB provides. SocketCore is an abstract class; that is, it cannot be instantiated by itself.
From this new SocketCore base class, two new subclasses are derived: TCPSocket and UDPSocket. The old Socket class has been deprecated (though it is still functional), and you are encouraged to use the new TCPSocket class instead. TCPSocket has new functionality, and has been rewritten for Mac OS 9 and OS X.
Changes for 5.5: With REALbasic 5.5, sockets have gone through another overhaul for Macintosh OS X. With Apple moving further away from supporting OpenTransport (in fact, they officially dropped support for OpenTransport when OS 10.3 was released), we decided to move the underlying implementation from OT to using straight BSD sockets. So again with version 5.5, sockets have been rewritten under the hood to use the best technology provided by the operating system.
Consequently, with this change, we were able to make our sockets behave identically on three separate platforms. Since OS X, Linux and Windows all have a POSIX-compliant (well, mostly) implementation of BSD sockets, and the code under the hood is identical for all three of those platforms. This should provide for an identical experience on all three of those platforms where sockets are concerned.
In addition to the under-the-hood changes we made, we added some new classes to help you write networking code without worrying about all the little details. We now provide three new helper classes for networking: EasyUDPSocket, EasyTCPSocket and AutoDiscovery.