Free Programming E-Books
Free download ebooks on computer and programming | |||
Free ebook "Real World .NET Applications" Sample Chapter
Real World .NET Applications
Download chapter
Free download chapter 5: Developing an FTP Client Application Real World .NET Applications consists of six significant .NET applications, each representing one of the major application types: a custom Windows control, an XML document editor, a Pac-Man-style game, a drawing application, an FTP client application, and an ASP.NET online store. Each application or component is thoroughly documented, starting from coverage of the underlying principles through the architecture and design, and finally the actual implementation of the application. Developing an FTP Client ApplicationFILE TRANSFER IS an important networking task, and File Transfer Protocol (FTP) client applications are still in wide use despite the ever-increasing popularity of the Web. The FTP client application built for this chapter complies with the current standard as specified in RFC959 by the World Wide Web Consortium (www.w3.org); you can use it to connect to and engage in file transfer with standard FTP servers. The main purpose of developing this application is to show how to work with sockets in the .NET Framework. Overview of the ChapterThis chapter starts by presenting a general overview of sockets and continues with FTP and the project itself. In this chapter, you will find the following sections:
Working with SocketsA socket is an end point of a connection. It is a descriptor that lets an application read from and write to the network. Using sockets, client applications and server applications can communicate by sending and receiving streams of bytes over connections. To send a message to another socket used in a software application, you need to know not only the machine's Internet Protocol (IP) address that hosts the software application but also the software's process identifier in that machine. A unique number, called a port, identifies a software process in a machine. Therefore, to send a message from a socket in one application to another socket in another connection, you need to know the machine's IP address and the application's port number. In the .NET Framework, the System.Net.Sockets.Socket class represents a socket. This class is an implementation of the Sockets Application Programming Interface (API), which is also known as the Berkeley sockets interface. The Sockets API was developed in the early 80s at the University of California at Berkeley for the 4.1c release of Berkeley Software Distribution (BSD) Unix. This distribution contained an early version of the Internet protocols. You can use the System.Net.Sockets.Socket class as a socket in a server application as well as in a client application. It also allows both synchronous and asynchronous operations. This chapter only covers using the Socket class in a client application. For more details on using this class in a server application, you should consult the .NET Framework documentation. | |||