This is warapper for Winsock DLL version 1.1 Differents from previous version: - UDP sockets support; - a LOT of bugs fixed (50% of code completely rewritten); - exception for error handling; In this unit you can find 3 classes (not visual components!) for working with Windows sockets. Extremely useful when writing console apps and services. class TServerSocket - implement general listening socket for accepting connections; class TClientSocket - implement general socket for transfering/receiving data. class TUDPSocket - implement general UDP socket. Usage: TServerSocket: constructor Create(port:string) - create master socket in bind to to port 'port'. 'port' may be port number or service name ('23' or 'telnet') procedure Listen - put socket in listen mode; procedure WaitForConnection - wait for somebody to connect to this socket. must be in listen mode (use Listen before); function AcceptConnection:TClientSocket - accept connection and return connected ClientSocket ready for transfering data; property FPeerIP:string - IP adress of connection just accepted; property FPeerName:string - DNS name of peer just accepted (if available) All methods raise ESocketErrorException with error message in Message when unsuccesfull. TClientSocket: constructor Create - create unconnected ClientSocket; procedure Connect(adr:string;port:string) - try to connect socket to adr:port adr may be DNS name or IP adress; port may be port or service name; procedure WaitForData - wait for data on socket. Wait infinite time; procedure WaitForDataTime(A:word) - same as prev. but wait A microseconds. If timeout occur exception ESocketTimeoutException is raised; function read(var buf;len:integer):integer - transfer len bytes from socket to buf. Return number of bytes actually received. function write - same as above. procedure Disconnect - close connection. All methods raise ESocketErrorException when error occured. TUDPSocket: constructor Create(port:strign) - create UDP socket and bind it port. port may be port number or service name; function SendBroadcast(var buf;len:integer;port:string):integer - send len bytes from buf broadcast to port 'port'. Return number of bytes received; function SendToAddr - same as prev., but send data to adr; function ReceiveFrom(var buf;len:integer;var rip,rport,rname:string):integer- receive UDP data. rip,rname,rport are set to sender ip, DNS name and port. Return number of bytes received. All methods raise ESocketErrorException if failed. Note. This unit use three procedures from unit messd: Dev(msg,lev) - to write debug message; Warn(msg) - to write non-critical warning; Err(msg) - to write critical error. You should rewrite this procedures according to your needs. P.S. This documentation is draft, so if any questions look at source first, then send me e-mail to akorud@polynet.lviv.ua