Secure Sockets Support

Flash Player 11 has had the ability to establish Transport Control Protocol (TCP) socket connections ever since they were introduced in Flash Player 9 with the class. Sockets allow an application to connect to a server and transmit binary data asynchronously between the client and server. This is often used for gaming, FTP, and connections to email servers over POP3.

With the addition of the class, we can now perform the same data transport on secure servers using Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols as well.

When invoking SecureSocket.connect(), the method expects two arguments. The first is the IP or full domain name of the server to connect to. The second is the port that is to be used to establish the socket connection. Actually receiving and transmitting data over an established socket connection is done in exactly the same way as if you were using an unsecured socket.

SecureSocket results readout

Figure 7-3. SecureSocket results readout

The figure above demonstrates some of the information that can be derived when connecting through a secure socket. In this case, we are making a secure socket connection to and then displaying some choice bits of data within a TextField on the Stage. The code to accomplish this is included below.

package { import flash.display.Sprite; import; import; ...

Get What's New in Flash Player 11 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.