| 1 Preface |
| 1.1 About this Book |
| 1.1.1 How this book is organized |
| 1.1.2 Writing Voice |
| 1.2 Focus on Core |
| 1.3 Class Names |
| 1.4 C# and Visual Basic Users |
| 1.5 Book Versions |
| 1.5.1 Indy 10 Version |
| 1.5.2 Indy 9 Version |
| 1.6 About the Authors |
| 1.6.1 About Chad Z. Hower a.k.a. Kudzu |
| 1.6.3 About Hadi Hariri - Technical Editor |
| 1.7 Feedback and Discussion |
| 1.8 Technical Support |
| 1.8.1 Free Support |
| 1.8.1.1 Indy Newsroups |
| 1.8.1.2 Borland Newsgroups |
| 1.8.2 Commercial Priority Support |
| 1.8.3 SSL Support |
| 1.8.4 Bug Reports |
| 1.8.5 Winsock 2 |
| 1.9 Additional Information |
| 1.9.1 Other Resources |
| 1.9.2 Further Reading |
| 1.10 Legal |
| 1.10.1 Copyright |
| 1.10.2 Acceptable Use - Personal |
| 1.10.3 Acceptable Use - Corporate |
| 1.11 Credits |
| 2 Introductory Topics |
| 2.1 Introduction to Sockets |
| 2.1.1 Overview |
| 2.1.2 TCP/IP |
| 2.1.3 Client |
| 2.1.4 Server |
| 2.1.5 IP Address |
| 2.1.6 Port |
| 2.1.7 Protocol |
| 2.1.8 Socket |
| 2.1.9 Host Name |
| 2.1.10 DNS |
| 2.1.11 TCP |
| 2.1.12 UDP |
| 2.1.13 ICMP |
| 2.1.14 HOSTS |
| 2.1.15 SERVICES |
| 2.1.16 Localhost (Loopback) |
| 2.1.17 Ping |
| 2.1.18 TraceRoute |
| 2.1.19 LAN |
| 2.1.20 WAN |
| 2.1.21 IETF |
| 2.1.22 RFC |
| 2.1.23 Thread |
| 2.1.24 Fork |
| 2.1.25 Winsock |
| 2.1.26 Stack |
| 2.1.27 Network Byte Order |
| 2.2 Introduction to Indy |
| 2.2.1 The Indy Way |
| 2.2.2 Indy Methodology |
| 2.2.3 How Indy is Different |
| 2.2.4 Overview of Clients |
| 2.2.5 Overview of Servers |
| 2.2.6 Threading |
| 2.2.7 Blocking vs Non-Blocking |
| 2.2.7.1 Programming Models |
| 2.2.7.2 More Models |
| 2.2.7.3 Blocking |
| 2.2.7.4 Non-Blocking |
| 2.2.7.5 History of Winsock |
| 2.2.7.6 Blocking is not Evil |
| 2.2.7.7 Pros of Blocking |
| 2.2.7.8 Cons of Blocking |
| 2.2.7.9 TIdAntiFreeze |
| 2.2.7.10 Pros of Non-Blocking |
| 2.2.7.11 Cons of Non-Blocking |
| 2.2.7.12 Comparison |
| 2.2.7.13 Files vs. Sockets |
| 2.2.7.14 Scenario |
| 2.2.7.15 Blocking File Write |
| 2.2.7.16 Non-Blocking File Write |
| 2.2.7.16.1 C# |
| 2.2.7.16.2 Delphi |
| 2.2.7.17 Just Like Files |
| 2.2.7.18 Aysnchronous Everything |
| 3 TCP |
| 3.1 Reading and Writing |
| 3.1.1 Read Methods |
| 3.1.1.1 AllData |
| 3.1.1.2 Capture |
| 3.1.1.3 CheckForDataOnSource |
| 3.1.1.4 InputBuffer |
| 3.1.1.5 InputBufferIsEmpty |
| 3.1.1.6 InputBufferAsString |
| 3.1.1.7 InputLn |
| 3.1.1.8 InputBufferToStream |
| 3.1.1.9 Readable |
| 3.1.1.10 ReadBytes |
| 3.1.1.11 ReadCardinal |
| 3.1.1.12 ReadChar |
| 3.1.1.13 ReadInteger |
| 3.1.1.14 ReadLn |
| 3.1.1.15 ReadLnSplit |
| 3.1.1.16 ReadLnWait |
| 3.1.1.17 ReadSmallInt |
| 3.1.1.18 ReadStream |
| 3.1.1.19 ReadString |
| 3.1.1.20 ReadStrings |
| 3.1.1.21 WaitFor |
| 3.1.2 Read Timeouts |
| 3.1.3 Write Methods |
| 3.1.3.1 Write (Cardinal) |
| 3.1.3.2 Write (Integer) |
| 3.1.3.3 Write (SmallInt) |
| 3.1.3.4 Write (String) |
| 3.1.3.5 Write (TIdBuffer) |
| 3.1.3.6 Write (TIdStream) |
| 3.1.3.7 Write (TStrings) |
| 3.1.3.8 WriteBytes |
| 3.1.3.9 WriteFile |
| 3.1.3.10 WriteLn |
| 3.1.4 Write Buffering |
| 3.1.5 Work Transactions |
| 3.1.5.1 OnWork Events |
| 3.1.5.2 Managing Your Own Work Transactions |
| 3.1.6 Live Streaming |
| 3.1.6.1 TLiveStream |
| 3.1.6.2 HTTP Client Live Stream Demo |
| 3.2 Detecting Disconnects |
| 3.2.1 Saying Good Bye |
| 3.2.2 Do you really need to know? |
| 3.2.3 I need to know now! |
| 3.2.3.1 Keep Alives |
| 3.2.3.2 Pings |
| 3.2.4 EIdConnClosedGracefully |
| 3.2.4.1 Why Does This Exception Occur in Servers? |
| 3.2.4.2 Why is it an Exception? |
| 3.2.4.3 Is it an Error? |
| 3.2.4.4 When is it an Error? |
| 3.2.4.5 Simple Solution |
| 3.3 TCP Clients |
| 3.3.1 Basic Client |
| 3.3.2 Handling Exceptions |
| 3.3.3 Exceptions are not Errors |
| 3.3.4 Delphi Debugger Note |
| 3.3.5 TIdAntiFreeze |
| 3.3.6 Demo - Zip Code Client |
| 3.3.6.1 Zip Code Protocol |
| 3.3.6.2 Code Explanation |
| 3.4 TCP Servers |
| 3.4.1 Server Types |
| 3.4.1.1 TIdTCPServer |
| 3.4.1.1.1 The Role of Threads |
| 3.4.1.1.2 Servers on Fibers |
| 3.4.1.2 TIdUDPServer |
| 3.4.1.3 TIdSimpleServer |
| 3.4.2 Threaded Events |
| 3.4.3 TCP Server Models |
| 3.4.3.1 OnExecute |
| 3.4.3.1.1 Example |
| 3.4.3.2 Command Handlers |
| 3.4.3.2.1 Example |
| 3.4.4 Thread Schedulers |
| 3.4.4.1 Thread Pooling |
| 3.4.4.2 Included Thread Schedulers |
| 3.4.4.2.1 TIdSchedulerOfThreadDefault |
| 3.4.4.2.2 TIdSchedulerOfThreadPool |
| 3.4.5 Zip Code Server |
| 3.4.5.1 OnExecute Implementation |
| 3.4.5.2 Support Code |
| 3.4.5.3 OnConnect |
| 3.4.5.4 OnExecute |
| 3.4.5.4.1 Code - C# |
| 3.4.5.4.2 Code - Delphi |
| 3.4.5.4.3 Discussion |
| 3.4.6 Command Handlers |
| 3.4.6.1 Implementation |
| 3.4.6.2 Example Protocol |
| 3.4.6.3 Base Demo |
| 3.4.6.4 Creating a Command Handler |
| 3.4.6.5 Command Handler Support |
| 3.4.6.5.1 Greeting |
| 3.4.6.5.2 ReplyExceptionCode |
| 3.4.6.5.3 ReplyUnknown |
| 3.4.6.5.4 Other Properties |
| 3.4.6.6 Testing the New Command |
| 3.4.6.7 Implementing HELP |
| 3.4.6.8 Automated HELP |
| 3.4.6.9 Implementing DATETIME |
| 3.4.6.10 Conclusion |
| 4 UDP |
| 4.1 Note |
| 4.2 Reliability |
| 4.3 Broadcasts |
| 4.4 Packet Sizes |
| 4.5 Confirmations |
| 4.5.1 Overview |
| 4.5.2 Acknowledgements |
| 4.5.3 Sequencing |
| 4.6 TIdUDPClient |
| 4.7 TIdUDPServer |
| 4.8 UDP Example - RBSOD |
| 4.8.1 Overview |
| 4.8.2 Usage |
| 4.8.3 Client |
| 4.8.4 Server |
| 5 SMTP Protocol |
| 5.1 What is SMTP? |
| 5.2 How does SMTP work? |
| 5.3 Indy SMTP Support |
| 5.4 TIdSMTP |
| 5.5 TIdMessage |
| 5.6 Constructing the Message |
| 5.7 Sending the Message |
| 5.8 QuickSend |
| 5.9 Send Mail Demo |
| 5.10 More Information |
| 6 POP3 Protocol |
| 6.1 Basic Overview |
| 6.2 POP3, the Deviant |
| 6.2.1 How does POP3 differ? |
| 6.3 Transactional |
| 6.4 Connection Lifetime |
| 6.5 Listing of Messages |
| 6.6 Identifying Messages |
| 6.7 Indy POP3 Client |
| 6.8 Demo - POP3 Tool |
| 6.8.1 Usage |
| 6.8.2 Listing Messages |
| 6.8.3 Deleting Messages |
| 6.8.4 Retrieving Messages |
| 6.8.4.1 Header |
| 6.8.4.2 Raw |
| 6.9 Demo - Simple retrieval in C# |
| 6.9.1 Running the Demo |
| 6.9.2 Output |
| 6.10 More Information |
| 7 HTTP Protocol |
| 7.1 The Firewall Friendly Protocol |
| 7.2 Demo - Minimal Web Server |
| 7.3 Demo - Eliza Web |
| 7.3.1 TEliza |
| 7.3.2 Building Eliza Web |
| 7.3.3 State Management |
| 7.3.4 Running Eliza Web |
| 7.4 More Information |
| 8 Implementing Protocols |
| 8.1 Protocol Terminology |
| 8.1.1 Conversational |
| 8.1.2 Plain Text |
| 8.1.3 Command |
| 8.1.4 Reply |
| 8.1.5 Response |
| 8.2 RFC Definitions |
| 8.2.1 RFC Status Codes |
| 8.2.1.1 Examples |
| 8.2.2 RFC Reply |
| 8.2.3 RFC Response |
| 8.2.4 RFC Transactions |
| 8.3 TIdRFCReply |
| 8.4 ReplyTexts |
| 8.5 The Chicken or the Egg? |
| 8.6 Defining a Custom Protocol |
| 8.7 Peer Simulation |
| 8.8 Zip Code Protocol |
| 8.8.1 Help |
| 8.8.2 Lookup |
| 8.8.3 Quit |
| 9 Debugging |
| 9.1 Logging |
| 9.2 Peer Simulation |
| 9.3 Record and Replay |
| 10 Proxies |
| 10.1 Transparent Proxies |
| 10.1.1 IP Masquerading / Network Address Translation (NAT) |
| 10.1.2 Mapped Ports / Tunnels |
| 10.1.3 FTP User@Site Proxy |
| 10.2 Non Transparent Proxies |
| 10.2.1 SOCKS |
| 10.2.2 HTTP (CERN) |
| 11 IOHandler Classes |
| 11.1 IOHandler Class |
| 11.1.1 IOHandlerSocket |
| 11.1.1.1 IOHandlerStack |
| 11.1.1.1.1 SSLIOHandlerSocketBase |
| 11.1.1.1.1.1 SSLIOHandlerSocketOpenSSL |
| 11.1.1.2 IOHandlerChain |
| 11.1.2 IOHandlerStream |
| 12 Intercept Classes |
| 12.1 Intercepts |
| 12.2 Logging |
| 12.3 Demo - Throttler |
| 12.3.1 Special Notes |
| 12.3.1.1 Exceptions May Occur |
| 12.3.1.2 Clear the Cache |
| 12.3.1.3 Non Aliased Host |
| 12.3.2 Running the Demo |
| 13 Encryption |
| 13.1 SSL - Secure Sockets |
| 13.1.1 Export Restrictions |
| 13.1.2 Secure HTTP / HTTPS |
| 13.1.3 Clients |
| 13.1.4 Servers |
| 13.1.5 Converting Certificates to PEM Format |
| 13.1.5.1 Exporting the Certificate |
| 13.1.5.2 Convert .pfx to .pem |
| 13.1.5.3 Splitting the .pem File |
| 13.1.5.4 Key.pem |
| 13.1.5.5 Cert.pem |
| 13.1.5.6 Root.pem |
| 13.1.6 SSL Buddy |
| 13.1.6.1 Generating Certificate Requests |
| 13.1.6.2 Generating Self-Signed Certificates |
| 13.1.6.3 Preparing Indy/IntraWeb Certificates |
| 13.1.6.4 Extracting a Root Certificate |
| 13.1.6.5 Installing Certificates |
| 13.1.6.6 Obtaining SSL Buddy |
| 14 Using C# and Visual Basic |
| 14.1 Why Delphi? |
| 14.2 What are TStream and IndyStrings? |
| 14.2.1 Conversion - C# |
| 14.2.2 Conversion - Visual Basic |
| 14.3 .NET differences |
| 14.4 What is the TId prefix for? |
| 14.5 Examples |
| 15 Indy 10 Overview |
| 15.1 Indy 10 Status |
| 15.2 Installing Concurrent Versions |
| 15.3 Compatibility |
| 15.4 Migration |
| 15.5 Major Changes and Additions |
| 15.5.1 .NET Support |
| 15.5.2 Separation of Packages |
| 15.5.3 IOHandler Restructuring |
| 15.5.3.1 Method Signatures |
| 15.5.4 TCP Server |
| 15.5.4.1 Server Split |
| 15.5.4.2 DFM Breakage |
| 15.5.4.3 Raw Reads and Writes |
| 15.5.4.4 New Event Sigature |
| 15.5.4.5 Contexts |
| 15.5.4.6 Schedulers |
| 15.5.5 SSL |
| 15.5.5.1 SSL Core |
| 15.5.5.2 SSL Protocols |
| 15.5.6 SASL |
| 15.5.7 FTP |
| 15.5.7.1 FTP Client |
| 15.5.7.2 FTP Server |
| 15.5.7.3 FTP List Parsing |
| 15.5.8 Super Core |
| 15.5.8.1 Network Interfaces |
| 15.5.8.2 Fibers |
| 15.5.8.3 Schedulers |
| 15.5.8.4 Work Queues |
| 15.5.8.5 Chains |
| 15.5.8.6 Chain Engines |
| 15.5.8.7 SuperCore Revealed |
| 15.5.9 Other |
| 15.6 Sample Conversions |
| 15.6.1 SendMail |
| 15.6.2 TCP Server |
| 16 Threading |
| 16.1 Concurrency |
| 16.1.1 Terminology |
| 16.1.1.1 Concurrency |
| 16.1.1.2 Contention |
| 16.1.1.3 Resource Protection |
| 16.1.2 Resolving Contention |
| 16.1.2.1 Read Only |
| 16.1.2.2 Atomic Operations |
| 16.1.2.3 Operating System Support |
| 16.1.2.4 Explicit Protection |
| 16.1.2.4.1 Critical Sections |
| 16.1.2.4.1.1 Win32 API Critical Sections |
| 16.1.2.4.1.2 Delphi 4 Standard Users |
| 16.1.2.4.2 TMultiReadExclusiveWriteSynchronizer (TMREWS) |
| 16.1.2.4.2.1 Delphi 4 and 5 |
| 16.1.2.4.2.2 Delphi 6 |
| 16.1.2.4.2.3 Kylix |
| 16.1.2.4.3 Choosing Between Critical Sections and TMREWS |
| 16.1.2.4.4 Mutexes |
| 16.1.2.4.5 Semaphores |
| 16.1.2.4.6 Events |
| 16.1.2.5 Thread Safe Classes |
| 16.1.2.6 Compartmentalization |
| 16.2 Threads |
| 16.2.1 What is a Thread? |
| 16.2.2 Threading Advantages |
| 16.2.2.1 Prioritization |
| 16.2.2.2 Encapselation |
| 16.2.2.3 Security |
| 16.2.2.4 Multiple Processors |
| 16.2.2.5 No Serialization |
| 16.2.3 Processes vs. Threads |
| 16.2.4 Threads vs. Processes |
| 16.2.5 Hundreds of Threads |
| 16.2.5.1 Realistic Thread Limits |
| 16.2.6 Threadable and ThreadSafe |
| 16.2.6.1 Threadable |
| 16.2.6.2 Threadsafe |
| 16.2.7 VCL Support |
| 16.2.7.1 TThread |
| 16.2.7.2 TThreadList |
| 16.2.7.3 Thread Variables |
| 16.2.7.4 Synchronization |
| 16.2.8 Indy Support |
| 16.2.8.1 TIdThread |
| 16.2.8.1.1 Thread Names |
| 16.2.8.2 TIdThreadComponent |
| 16.2.8.3 TIdSync |
| 16.2.8.4 TIdNotify |
| 16.2.8.5 TIdThreadSafe |
| 16.2.9 Common Problems |
| 16.3 Eliminating Bottlenecks |
| 16.3.1 Common Bottleneck Causes |
| 16.3.1.1 Critical Section Implementation |
| 16.3.1.2 TMREWS |
| 16.3.1.2.1 Performance Comparison |
| 16.3.1.3 Syncrhonizations |
| 16.3.1.4 User Interface Updates |
| 16.4 Fibers |
| 17 Bonus Materials |
| 17.1 Miscellany |
| 17.1.1 Piracy and Unconventional Wisdom |
| 17.1.1.1 Introduction |
| 17.1.1.2 Show Me the Money |
| 17.1.1.3 Ghost Sales |
| 17.1.1.4 Cat and Mouse |
| 17.1.1.5 A Little Piracy Can Be Good Now and Then |
| 17.1.1.6 Financial Incentives |
| 17.1.1.7 Your Software Will *NEVER* be Pirate Proof |
| 17.1.1.8 Impact to YOUR Customers |
| 17.1.1.9 Draconian Solutions |
| 17.1.1.10 Creating Pirates |
| 17.1.1.11 Example 1: Microsoft |
| 17.1.1.12 Example 2: Record Companies |
| 17.1.1.13 Release Often |
| 17.1.1.14 Sell Benefits They Cannot Pirate |
| 17.1.1.15 Make it Cheaper to Buy |
| 17.1.1.16 Defend, Don't Attack |
| 17.1.1.17 Be Up Front |
| 17.1.1.18 Goals of Piracy Prevention |
| 17.1.1.19 DO's of Piracy Protection |
| 17.1.2 Biological Studies as the Basis of Encryption |
| 17.1.3 Outsourcing and Dead Presidents |
| 17.1.4 Developers are from Mars, Managers are from Venus |
| 17.1.4.1 A Developer Says |
| 17.1.4.1.1 I refactored it |
| 17.1.4.1.2 Its an elegant implementation |
| 17.1.4.1.3 I saved 2 bytes |
| 17.1.4.1.4 It doesn't need testing |
| 17.1.4.1.5 It dosen't need comments |
| 17.1.4.1.6 I reused some code |
| 17.1.4.1.7 Oops.... Never mind |
| 17.1.4.1.8 Its not a bug, its a documentation issue |
| 17.1.4.1.9 We need some more time |
| 17.1.4.2 A Manager Says |
| 17.1.4.2.1 I just read about x. I want the whole team to use x. |
| 17.1.4.2.2 Just ship it. |
| 17.1.4.2.3 I don't need it "good", I need it fast |
| 17.1.4.2.4 If it will take you 4 weeks, 4 of you can do it in a week, right? |
| 17.1.4.2.5 Can you make a use case diagram? |
| 17.1.4.2.6 Will this affect the critical path? |
| 17.1.6 What is important in life? Are C++ developers human? |
| 17.2 Delphi |
| 17.2.1 Why Delphi for .NET? |
| 17.2.2 Porting Delphi applications to Delphi for the .NET framework |
| 17.2.2.1 Special Note |
| 17.2.2.2 Terms |
| 17.2.2.2.1 CIL |
| 17.2.2.2.2 CLR |
| 17.2.2.2.3 CTS |
| 17.2.2.2.4 CLS |
| 17.2.2.2.5 Managed Code |
| 17.2.2.2.6 Unmanaged Code |
| 17.2.2.2.7 Assembly |
| 17.2.2.3 Compilers / IDE's |
| 17.2.2.3.1 DCCIL (Diesel) |
| 17.2.2.3.1.1 Beta |
| 17.2.2.3.2 Delphi 8 |
| 17.2.2.3.3 SideWinder |
| 17.2.2.3.4 Galileo |
| 17.2.2.4 Frameworks |
| 17.2.2.4.1 .Net Framework |
| 17.2.2.4.2 WinForms |
| 17.2.2.4.3 RTL |
| 17.2.2.4.4 CLX |
| 17.2.2.4.5 VCL for .Net |
| 17.2.2.4.6 WinForms or VCL for .Net? |
| 17.2.2.5 Additions |
| 17.2.2.5.1 Mapping to CTS |
| 17.2.2.5.2 Namespaces |
| 17.2.2.5.3 Nested Types |
| 17.2.2.5.4 Custom Attributes |
| 17.2.2.5.5 Other |
| 17.2.2.6 Restrictions |
| 17.2.2.6.1 Unsafe Items |
| 17.2.2.6.1.1 Unsafe Types |
| 17.2.2.6.1.2 Unsafe Code |
| 17.2.2.6.1.3 Unsafe Casts |
| 17.2.2.6.2 Deprecated Functionality |
| 17.2.2.7 Changes |
| 17.2.2.7.1 Destruction |
| 17.2.2.7.1.1 Deterministic Destruction |
| 17.2.2.7.1.2 Non-Deterministic Destruction |
| 17.2.2.7.2 Garbage Collection |
| 17.2.2.8 Porting Steps |
| 17.2.2.8.1 Remove Unsafe Warnings |
| 17.2.2.8.2 Unit Namespaces |
| 17.2.2.8.3 Convert DFM's |
| 17.2.2.8.4 Convert Project File |
| 17.2.2.8.5 Resolve Class Differences |
| 17.2.2.8.6 Add Luck |
| 17.2.2.9 Credits |
| 17.2.3 Developing single source Delphi - Win32, .NET, and Linux |
| 17.2.3.1 Delphi 9 |
| 17.2.3.2 How? |
| 17.2.3.3 Cross Platform |
| 17.2.3.4 Platform Specific Features |
| 17.2.3.5 Pure Code |
| 17.2.3.5.1 Managed Code |
| 17.2.3.5.2 Safe Code |
| 17.2.3.5.3 P/Invoke Free |
| 17.2.3.6 Delphi |
| 17.2.3.6.1 Delphi 7 |
| 17.2.3.6.2 Delphi Magic |
| 17.2.3.6.3 P/Invoke Usage |
| 17.2.3.6.3.1 SysUtils Patch |
| 17.2.3.6.4 Unsafe Code |
| 17.2.3.7 .NET Common Error |
| 17.2.3.7.1 Object reference not set to something or other |
| 17.2.3.7.2 Object is not ready yet (XP style) |
| 17.2.3.7.3 It's a .NET AV |
| 17.2.3.8 .NET - Things remembered |
| 17.2.3.8.1 Pointers |
| 17.2.3.8.2 Buffers (Untyped Variables) |
| 17.2.3.8.3 Win32 |
| 17.2.3.8.4 Globals |
| 17.2.3.8.4.1 Delphi Globals |
| 17.2.3.8.5 Sets |
| 17.2.3.9 Things Different |
| 17.2.3.9.1 Strings |
| 17.2.3.9.1.1 Immutable |
| 17.2.3.9.1.2 Empty String |
| 17.2.3.9.1.3 String Help |
| 17.2.3.9.1.3.1 StringBuilder |
| 17.2.3.9.1.3.2 AnsiString |
| 17.2.3.9.1.3.3 TIdBuffer |
| 17.2.3.9.2 TList / TStrings |
| 17.2.3.9.3 Initialization and Finalization |
| 17.2.3.9.3.1 Initialization |
| 17.2.3.9.3.2 Finalization |
| 17.2.3.9.4 Units |
| 17.2.3.9.5 TStream |
| 17.2.3.9.5.1 TStream - Win32 |
| 17.2.3.9.5.2 TStream - .NET |
| 17.2.3.9.5.3 TStream - Example |
| 17.2.3.9.5.4 TStream Problems |
| 17.2.3.9.6 Variants |
| 17.2.3.9.7 Typecasts |
| 17.2.3.9.8 Constructors and Destructors |
| 17.2.3.10 New Friends |
| 17.2.3.10.1 StringBuilder |
| 17.2.3.10.2 FCL |
| 17.2.3.10.3 Byte Arrays |
| 17.2.3.10.4 Unicode |
| 17.2.3.10.5 True Language Interoperability |
| 17.2.3.11 Handling Platform Differences |
| 17.2.3.11.1 Example |
| 17.2.3.11.2 Isolated Units |
| 17.2.3.11.3 Polymorphs |
| 17.2.3.11.4 Indy |
| 17.3 Design |
| 17.3.1 Short Circuits or Faulty Circuits? |
| 17.3.2 Database Design and Modelling for Developers |
| 17.3.2.1 Concepts |
| 17.3.2.1.1 Unique Key |
| 17.3.2.1.2 Primary Key |
| 17.3.2.1.3 Foreign Key |
| 17.3.2.1.4 Surrogate Key (a.k.a. Non Decomposable) |
| 17.3.2.1.5 Intelligent Key (a.k.a. Decomposable Key) |
| 17.3.2.1.6 Referential Integrity (RI) |
| 17.3.2.2 Ground Rules |
| 17.3.2.3 Database Design |
| 17.3.2.3.1 Naming |
| 17.3.2.3.1.1 Avoid Abbreviations |
| 17.3.2.3.1.2 Do Not Use Spaces |
| 17.3.2.3.1.3 Use Underscores |
| 17.3.2.3.1.4 Use ID and Code Suffixes |
| 17.3.2.3.1.4.1 Example |
| 17.3.2.3.1.5 Name Followed by a Modifier |
| 17.3.2.3.1.6 Liven Your Booleans |
| 17.3.2.3.1.7 Define Your Booleans |
| 17.3.2.3.1.7.1 Example Problem 1 |
| 17.3.2.3.1.7.2 Example Problem 2 |
| 17.3.2.3.1.8 Do Not Use Column Names That Match Parent Table Names |
| 17.3.2.3.1.9 Link Tables |
| 17.3.2.3.2 Tables |
| 17.3.2.3.2.1 Make Table Names Singular |
| 17.3.2.3.2.2 Use Referential Integrity |
| 17.3.2.3.2.3 A Database with a View |
| 17.3.2.3.2.4 Denormalization / Normalization |
| 17.3.2.3.2.5 Primary Keys |
| 17.3.2.3.2.5.1 Simple Keys |
| 17.3.2.3.2.5.2 Avoid Compound Keys |
| 17.3.2.3.2.5.3 Unique Names |
| 17.3.2.3.2.5.4 Foreign Keys |
| 17.3.2.3.2.5.5 Auto Generation |
| 17.3.2.3.2.5.6 Get High |
| 17.3.2.4 Happy Users |
| 17.3.2.4.1 Pause and Review |
| 17.3.2.4.2 Exercise |
| 17.3.3 Dude, Where's my business logic? |
| 17.3.3.1 Introduction |
| 17.3.3.2 About this Article |
| 17.3.3.3 Goal |
| 17.3.3.4 Terms |
| 17.3.3.4.1 Tier |
| 17.3.3.4.2 Layer |
| 17.3.3.5 Evolution of a Problem |
| 17.3.3.5.1 Desktop |
| 17.3.3.5.2 Client Server |
| 17.3.3.5.3 3 - Tier |
| 17.3.3.6 What is Business Logic? |
| 17.3.3.6.1 Delete Customer |
| 17.3.3.6.2 Formatting |
| 17.3.3.6.3 Exceptions |
| 17.3.3.7 Systems Today |
| 17.3.3.7.1 Client Server |
| 17.3.3.7.2 N-Tier |
| 17.3.3.7.2.1 Scenario 1 |
| 17.3.3.7.2.2 Scenario 2 |
| 17.3.3.7.3 Consolidation |
| 17.3.3.8 Moving to the Middle Tier |
| 17.3.3.8.1 Slippery Slope |
| 17.3.3.8.2 Cheaper |
| 17.3.3.8.3 Easier |
| 17.3.3.8.4 Topology |
| 17.3.3.8.5 Grow the Middle |
| 17.3.3.8.6 Bottleneck |
| 17.3.3.9 Obstacles |
| 17.3.3.9.1 Habits |
| 17.3.3.9.2 Procedures |
| 17.3.3.9.3 Database Administrators |
| 17.3.3.9.4 Tools |
| 17.3.3.10 Solutions |
| 17.3.3.10.1 Architect Policing |
| 17.3.3.10.2 DA Education |
| 17.3.3.10.3 Management Education |
| 17.3.3.11 Further Reading |
| 17.3.3.12 Conclusion |
| 17.3.5 Tier Pressure and Isolationism |
| 17.3.5.1 Physical Tiers |
| 17.3.5.2 Tiers of Layers |
| 17.3.5.3 Logical Limbo |
| 17.3.5.4 Patterns |
| 17.3.5.4.1 Storage Layer Driven Pattern |
| 17.3.5.4.2 Presentation Layer Driven Pattern |
| 17.3.5.4.3 Isolation Driven Pattern |
| 17.3.5.4.4 Comparison |
| 17.3.5.5 Partitioned Roles |
| 17.3.5.5.1 Role Roaming |
| 17.3.5.5.2 Small Teams |
| 17.3.5.5.3 Tiny Teams and Lone Developers |
| 17.4 Databases |
| 17.4.1 Easier Database Transactions - Extending the Using Statement to Perform Automatic Database Transactions |
| 17.4.2 Extending C# to Support SQL Syntax at Compile Time |
| 17.4.2.1 Introduction |
| 17.4.2.2 C Omega |
| 17.4.2.3 Future Articles |
| 17.4.2.4 Neither Meat nor Fish |
| 17.4.2.5 Extreme Databases |
| 17.4.2.6 One Language |
| 17.4.2.7 Views |
| 17.4.2.7.1 View Types |
| 17.4.2.7.1.1 Tables / Views |
| 17.4.2.7.1.2 Stored Procedures |
| 17.4.2.7.1.3 Queries |
| 17.4.2.7.2 Generation |
| 17.4.2.8 Examples |
| 17.4.2.8.1 Database |
| 17.4.2.8.2 Code Samples |
| 17.4.2.8.2.1 Reading from a View |
| 17.4.2.8.2.1.1 Manual Read |
| 17.4.2.8.2.2 Accessing Columns |
| 17.4.2.8.2.2.1 Null |
| 17.4.2.8.2.3 Inserting a Row |
| 17.4.2.8.2.4 Updating a Row |
| 17.4.2.8.2.5 Filtering Data |
| 17.4.2.8.2.6 Other Operations |
| 17.4.2.9 DataBindings |
| 17.4.2.10 Supported Databases |
| 17.4.2.11 Implementation Notes |
| 17.4.2.11.1 Roots |
| 17.4.2.11.2 .NET 2.0 |
| 17.4.2.11.3 C# |
| 17.4.2.12 Open Source |
| 17.5 Mobile Agents |
| 17.5.1 Mobile Agents - Software on the Move |
| 17.5.2 Origins |
| 17.5.3 Focus on Mobility |
| 17.5.4 Remoting versus Mobile Agents |
| 17.5.5 No Single Solution |
| 17.5.6 No Client, no Server |
| 17.5.7 Items not Covered |
| 17.5.8 Advantages |
| 17.5.8.1 Single Code Base |
| 17.5.8.2 No Interprocess Communication |
| 17.5.8.3 No Deployment |
| 17.5.8.4 Easily Modified |
| 17.5.9 Disadvantages |
| 17.5.9.1 Bandwidth |
| 17.5.10 Concepts and Terms |
| 17.5.10.1 Tarakan |
| 17.5.10.2 Host |
| 17.5.10.3 Spawn |
| 17.5.10.4 Home |
| 17.5.10.5 Gateway |
| 17.5.11 Security using Gateways |
| 17.5.12 Examples |
| 17.5.12.1 Data Collection |
| 17.5.12.1.1 Scenario |
| 17.5.12.1.1.1 Traditional |
| 17.5.12.1.1.2 Implementation |
| 17.5.12.2 Data Collection - Larger Data |
| 17.5.12.2.1 Scenario |
| 17.5.12.2.1.1 Implementation |
| 17.5.12.3 Network Mapping |
| 17.5.12.3.1 Scenario |
| 17.5.12.3.1.1 Implementation |
| 17.5.12.4 Searching |
| 17.5.12.4.1 Scenario |
| 17.5.12.4.1.1 Implementation |
| 17.5.12.5 Finding Resources to Complete Task |
| 17.5.12.5.1 Scenario |
| 17.5.12.5.1.1 Implementation |
| 17.5.12.6 Distributed Processing |
| 17.5.12.6.1 Scenario |
| 17.5.12.7 Disconnected Processing |
| 17.5.12.7.1 Scenario |
| 17.5.12.7.1.1 Traditional |
| 17.5.12.8 Pushing |
| 17.5.12.8.1 Scenario |
| 17.5.12.9 Hold and Store |
| 17.5.12.9.1 Scenario 1 |
| 17.5.12.9.2 Scenario 2 |
| 17.5.12.10 Move from User to User |
| 17.5.12.10.1 Scenario |
| 17.5.12.10.1.1 Traditional |
| 17.5.12.10.1.2 Implementation |
| 17.5.12.11 Business Logic |
| 17.6 .NET |
| 17.6.1 Why .NET? |
| 17.6.1.1 Like it or not, .NET is coming |
| 17.6.1.2 Pure Code |
| 17.6.1.2.1 Managed Code |
| 17.6.1.2.2 Safe Code |
| 17.6.1.2.3 P/Invoke Free |
| 17.6.1.3 Reasons for .NET |
| 17.6.1.3.1 "It's big, and it's Microsoft." |
| 17.6.1.3.2 Platform Potential |
| 17.6.1.3.3 Standardized, Rich Class Libraries |
| 17.6.1.3.4 The Future is Faster |
| 17.6.1.3.4.1 Future Exception |
| 17.6.1.3.5 Language Nuetral |
| 17.6.1.3.5.1 Improved Visual Basic |
| 17.6.1.3.5.2 Modernized C++ |
| 17.6.1.3.5.3 Delphi |
| 17.6.1.3.6 Saying good-bye, and good riddance |
| 17.6.1.3.6.1 Fewer Crashes |
| 17.6.1.3.6.2 Memory Corruption |
| 17.6.1.3.6.3 Access Violations |
| 17.6.1.3.6.4 Code Misjumps |
| 17.6.1.4 Debunking Myths |
| 17.6.1.4.1 .NET has a Big Runtime. |
| 17.6.1.4.2 .NET is Slow. |
| 17.6.1.4.3 But I ported my application and it's 100 times slower! |
| 17.6.1.4.4 Loss of Control |
| 17.6.1.4.5 .NET is Interpreted |
| 17.6.1.5 Obstacles |
| 17.6.1.5.1 C++ |
| 17.6.1.5.2 C# |
| 17.6.1.5.3 Visual Basic |
| 17.6.1.5.4 Existing Code |
| 17.6.1.6 Java |
| 17.6.1.6.1 Why not Java? |
| 17.6.1.6.2 Java's Future |
| 17.6.1.7 The Future of .NET |
| 17.6.1.7.1 Mainframes |
| 17.6.1.7.2 Servers |
| 17.6.1.7.3 Linux |
| 17.6.1.7.4 Windows |
| 17.6.1.8 Re-education |
| 17.6.1.9 Summary |
| 17.6.2 Storing Application Options and User Preferences in .NET |
| 17.6.2.1 Why not INI, Registry or XML? |
| 17.6.2.1.1 INI Files |
| 17.6.2.1.2 Registry |
| 17.6.2.1.3 Application.config |
| 17.6.2.1.4 System.XML |
| 17.6.2.2 What to use instead? |
| 17.6.2.3 Typed Datasets |
| 17.6.2.4 Simple Demo |
| 17.6.2.5 Conclusion |
| 17.6.3 For C# - For and For More |
| 17.6.3.1 Code |
| 17.6.4 Displaying and Working with Forms |
| 17.6.4.1 Non Modal |
| 17.6.4.1.1 Pattern |
| 17.6.4.1.2 Disposal |
| 17.6.4.2 Modal |
| 17.6.4.2.1 Pattern |
| 17.6.4.2.2 Disposal |
| 17.6.4.2.3 Returning a Result |
| 17.6.4.3 Passing Data |
| 17.6.4.4 Static Show |
| 17.6.4.5 Keeping a Reference |
| 17.6.5 Obtaining Current DataTable Row for a DataGrid |
| 17.6.5.1 Introduction |
| 17.6.5.2 Code |
| 17.6.5.3 Position |
| 17.6.5.4 Shortcutting |
| 17.6.6 Dynamically Loading Assemblies |