DWINSOCK V1.0 ------------- A Windows Socket interface component for use with Borland Delphi. By Ulf Söderberg ulfs@sysinno.se This is a short description of the DWinSock component for Borland Delphi that is contained in the file DWINSOCK.ZIP. I am going to create a Delphi installable help file sometime soon. For now, you have to rely on this description and on the contents of the source files. FILE CONTENTS ------------- Files that originally came from PASOCK10.ZIP that has been changed by me: WINSOCK.INC Part of the old WINSOCK.PAS (included in DWINSOCK.PAS) WINSOCK.IF Part of the old WINSOCK.PAS (included in DWINSOCK.PAS) WINSOCK.IMP Part of the old WINSOCK.PAS (included in DWINSOCK.PAS) ERROR.INC Part of the old WINSOCK.PAS (included in DWINSOCK.PAS) Original work by myself: DWINSOCK.RES Contains two bitmaps for the controls, just blank bitmaps now. DWINSOCK.DCR Contains two component palette bitmaps (very Q&D). DWINSOCK.PAS The source code of the component. DWINSOCK.DCU The compiled unit. THE COMPONENTS IN DWINSOCK -------------------------- DWinSock contains two components which I have named TClientSocket and TServerSocket. As the names implies, they are to be used in client or server applications. TClientSocket Properties Host name of remote host, a string Address address of remote host, a string like '127.0.0.1' Port port number, an integer Service name of port, a string Conn current TSocket Description name of underlying WinSock Text send or receive a string BytesSent get number of bytes sent after last assign to Text TClientSocket Methods LocalHost name of yourself Reverse reverse lookup an address Open do a connect Close the opposite SendBuf send a buffer RecvBuf receive a buffer TClientSocket Events OnInfo progress indication OnConnect OnDisconnect OnRead incoming data OnWrite out buffer empty TServerSocket Properties Port port number, an integer Service name of port, a string Conn current TSocket Description name of underlying WinSock Client default array prop. to get TSocket of a connected client TServerSocket Methods LocalHost name of yourself Reverse reverse lookup an address Listen listen for incoming connections Close the opposite SendBuf send a buffer RecvBuf receive a buffer TServerSocket Events OnInfo progress indication OnAccept incoming connection accepted OnDisconnect connection closed OnRead incoming data OnWrite outuf empty OTHER OBJECTS ------------- Both TClientSocket and TServerSocket uses an object called TSocket which contains the connection status like ip address and port number. TSocket has several methods that you may call, they are: LookupName convert a host name to an IP address. LookupService convert a service name to a port number. LocalAddress return your address for a connection. LocalPort return your port number for a connection. RemoteHost return the remote host name. RemoteAddress return the remote IP address. RemotePort return the remote port number. EXCEPTIONS ---------- If anything goes wrong inside you will get an exception of type ESockError with a message indicating what kind of error that cause the exception. SUMMARY ------- This was a very brief description of DWINSOCK. As you can see from the source files it does not at all use all functions of Windows Sockets but it may provide a quick solution to get into WinSock programming with Delphi. I have included a sample application called NETTIME that is a time client. It gets the current time of day from a time server. You may use DWINSOCK any way you like but don't blame me. Suggestions may be emailed to ulfs@sysinno.se