Sockets, Shellcode, Porting & Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals

Java Sockets is a programming interface designed to enable applications written in the Java programming language to communicate using the Transmission Control Protocol (TCP)/Internet Protocol (IP) suite of protocols. The Java Sockets application-programming interface (API) provides a simple, easy-to-use set of classes that abstracts a majority of the complexity inherent in networking programming. These classes make up the java.net package and are part of the Java2 standard.
The java.net package includes support for TCP and User Datagram Protocol (UDP) client and server sockets. It also supports IP network address and Domain Name System (DNS) resolution to include various other network-related usages.
This chapter looks at TCP and UDP client and server socket programming using the java.net classes. We also take a brief look at IP address and hostname resolution and multithreaded handling of TCP client connections.
| Note | All of the example source code in this chapter was written and compiled using the Java 2 v1.4.1 standard edition Software Development Kit (SDK) on the Microsoft Windows2000 platform. |
The TCP/IP suite of protocols comprises a number of network communications protocols. The most commonly used protocols for application-level communication are TCP and UDP. The TCP protocol provides reliable, connection-oriented functionality with support for connection multiplexing using ports. The remote host that data is sent to is guaranteed to properly receive the data when the TCP protocol is employed. TCP is reliable but somewhat slow due to the overhead needed to implement complex error-checking and...