O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Client Sockets

A client opens a socket by specifying the host address and port number for the server of the socket. The host address gives the network location (i.e., which computer), and the port selects a particular server from all the possible servers that may be running on that host. For example, HTTP servers typically use port 80, while FTP servers use port 20. The following example shows how to open a client socket to a Web server:

set s [socket www.scriptics.com 80]

There are two forms for host names. The previous example uses a domain name: www.scriptics.com. You can also specify raw IP addresses, which are specified with four dot-separated integers (e.g., 128.15.115.32). A domain name is mapped into a raw IP address by the system software, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required