Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

Developing TCPIP Servers in Borland Compilers

Title: Developing TCP/IP Servers in Borland Compilers Question: Many people ask, how can I write a strong Web Server, or build a killer Mail Server using their Borland Compiler? Answer: Brain Patchwork DX, LLC. (www.bpdx.com) has produced what we feel is the ultimate socket development SDK. Instead of spending months to develop basic TCP functionality with the products included in the compiler, you should try this framework! With DXSock, you have the ability to build a wide range of "end user packages". Including Windows 9x/Me GUI or TaskBar Applications, Standard Console Applications, NT/2000 Services, etc. No matter what type of end user package, the framework is 99% percent the same. The product was designed to learn once, and start developing and releasing, and includes native source code for 6 different compilers! Now to develop a WebServer for example, you will need to incorporate into your end user package the DXHTTPServerCore. This component/object contains all of the standard HTTP/1.1 protocol specifications, the ability to dynamically add new commands to the dynamic command set parser, and property controls for all of your socket and threading requirements. All you have to do is implement the commands you wish to support from the HTTP/1.1 specification. Everything else is done for you. Example (Simple) to support the GET command: Procedure Form1.OnCreate() Begin DXHTTPServerCore1.Start; End; Procedure Form1.OnClose() Begin DXHTTPServerCore1.Stop; End; Procedure Form1.DXHTTPServerCore1OnNewConnect() Begin DXHTTPServerCore1.ProcessSession(ClientThread); End; Procedure Form1.DXHTTPServerCore1OnCommandGet() Begin // A Very BASIC HTTP Header: ClientThread.Socket.Writeln('HTTP/1.1 '+Headertext(StatusCode)+#13#10+ 'Content-Type: text/html'+#13#10#13#10); // Static "HELLO WORLD" Web Page With ClientThread.Socket do Begin Writeln('Hello World'); Writeln(''); Writeln('Hello World!'); Writeln(''); End; End; As you can see, it was extremely simple and straight forward. 1. You start the server (without making a change to any properties, it is ready to run, but you could have tweaked the properties if you wanted to). 2. You call the Internal Parser (ProcessSesion()). 3. You implement the command, in this case "GET". 4. When you application wants to terminate, you simply tell the server core to STOP. When the ServerCore detects a new connection, the OnNewConnect event is fired. Allowing you to do any tweaking to the current thread, or setup a pointer of data or a record structure and track it via the current ClientThread's fpSessionData, and of course call the Internal Dyanmic Command Parser via .ProcessSession(). The Command Parser see's the client has done GET request, and fires the OnCommandGet event. One property of the Event is called HeaderInfo, which is a pre-parsed structure of the client/browser header. Everything is broken up for you, so you can quickly use things like: HeaderInfo^.ClientAddr HeaderInfo^.Protocol HeaderInfo^.AuthName Which allows you to truely build a custom web server, or web interface in minutes! What about, robust large scale designs? DXSock v2.1 supports: 1. 18 different logging formats, co-designed with WebTrends. So you can quickly have logging that one of the leading analizers will support. The logging components use two different technics to cache data in-memory before flushing to disk. Size and Age. 2. Caching File Content via DXWebFAT and DXFileAllocatonTable. Reducing redundant file system calls, to an in-memory cache table. The caching file content components also use different technics to manage the cache for you. 3. The HTML Compressor, rips through your HTML pages (4.0 and older command sets) and filters bulky commands, to their smaller counterpart, removes taps, excess spacing, etc. Which reduces your overall bandwidth consumption. Allowing you to develop HTML is a GUI, but know the transmitted data is compact! 4. SSI and SSI+ (Server Side Includes) scripting html is supported. Allowing you to produce dynamic content, without writing special code in your application. You can extend the SSI/SSI+ command set, and practically produce a true SCRIPTING lanaguage! 5. ISAPI and CGI Hosting. This, to say the least is impressive! You can extend the functionality of any web server by producing CGI and ISAPI programs, but now you can write your own web solution, and include these key extensions!! There are many more features, and add-ons included in the suite (over 80 compoentns total in DXSock v2.1). Each has been well thought out, to optimize reduancy calls, to provide self-cleaning mechanisms, and to produce stable yes lightning fast solutions. For More Information Visit: http://www.dxsock.com/ The DXSock Web Site, runs on a Web Server written entirely in Delphi, using DXSock!! We support Delphi2 through Delphi6, CBuilder3 through CBuilder5, Kylix, All Versions of JBuilder, Microsoft Visual C++ 5 and 6, and Sun's JDK 1.2 and up. Customers have access to over 11mb of ready to run source code, and receive 24hr technical support, and 12mths of free upgrades! And currently we are having a special introductory sell for either "Web Server Only" or "Message Oriented Servers Only", for $99.00 - NO SOURCE.