uses TCPServerSocket
/* {"description" : "This data type represents a network endpoint."} */
data NetworkEndpoint{
/* {"@description" : "The host address of this network endpoint."} */
char address[]
/* {"@description" : "The associated port number of this network endpoint."} */
int port
}
/* {"description" : "Communicate over the TCP network protocol. New connections can be established either using 'connect' (for a client) or by using 'accept' (for a server, in conjunction with a TCPServerSocket instance)."} */
interface TCPSocket extends net.Stream {
/* {"@description" : "In non-blocking mode, this event is fired when a send() fails due to the socket not being ready. The socket should be set for write-ability notification in e.g. a TCPMonitor, then when a writeable notification arrives, sendBuffer() should be called to send pending bytes."} */
event sendWait(Data d)
/* {"@description" : "Connect to the given TCP server."} */
bool connect(char address[], int port)
/* {"@description" : "Establish a TCP connection by accepting a new client via a TCP server socket."} */
bool accept(TCPServerSocket server)
/* {"@description" : "Disconnect (terminate) this TCP connection."} */
void disconnect()
/* {"@description" : "Get the endpoint details of the remote end of this TCP connection."} */
NetworkEndpoint getRemoteEndpoint()
/* {"@description" : "Get the endpoint details of the local end of this TCP connection."} */
NetworkEndpoint getLocalEndpoint()
/* {"@description" : "Switch the socket to non-blocking mode. In this mode, calls to recv() will always return 'immediately' but may read no data. Non-blocking TCP sockets are normally used with net.TCPMonitor. The optional data instance is delivered via any sendWait() events."} */
bool setNonBlocking(opt store Data sendWaitData)
/* {"@description" : "In non-blocking mode only, send any pending bytes; this should be called after a write-ability notification has been received from a TCPMonitor."} */
int sendBuffer()
/* {"@description" : "In non-blocking mode only, check how many bytes are in the send buffer pending write-ability."} */
int getBufferUnsent()
/* {"@description" : "Test whether or not this socket is connected (this is useful only in non-blocking mode, to determine whether a null return from recv() is temporary or terminal)."} */
bool connected()
}To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n net.TCPSocket -m "reason for update" -u yourUsername
Version 2 (this version) by barry
Notes for this version: Updates documentation strings.