public:
DSNetwork * acceptIncoming();
Accept an incoming connection onto a fresh network connection.
Result: A pointer to the newly created Network connection.public:
BOOL connectToHost(char * host, unsigned short nPort);
Connect to the specified hostname. It can process hostnames in the form hostname:port. Note that this function uses gethostbyname to resolve hostnames, and is therefore not threadsafe. You should protect accesses to this function via mutexes, and ensure that gethostbyname is either not used elsewhere or is protected with the same locks.
Result: TRUE if the connection succeeds, FALSE if it does not.
Name Description host The name of the host to connect to, can include :port syntax. nPort The port to connect to, if no port is specified with the hostname.
public:
BOOL getChar(char * ch);
Retrieves a single incoming character.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.
Name Description ch Specifies where to place the character.
public:
BOOL getChar(unsigned char * ch);
Retrieves a single incoming character.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.
Name Description ch Specifies where to place the character.
public:
BOOLX getLineFromSocket(char * buffer, int size);
Retrieves an incoming line from the network, if it's there.
Result: Returns YES if the operation succeeded, NO if an error occurred, and NOTYET if a complete line isn't available for reading...yet.
Name Description buffer Specifies the buffer where the line will be copied to. size Specifies the maximum size of the buffer.
public:
BOOL getLineFromSocketWait(char * buffer, int size);
Retrieves an incoming line from the network, and wait till it arrives.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.
Name Description buffer Specifies the buffer where the line will be copied to. size Specifies the maximum size of the buffer.
public:
BOOL getSlab(char * buffer,int nSize);
Retrieves an incoming pile of data from the network, and wait till it arrives.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.
Name Description buffer Specifies the buffer where the line will be copied to. nSize Specifies the size to be read.
public:
SOCKET getSocket();
Retrieves the socket used for low-level operations. Use this with great care. Specifically, only use this only if you need it.
Result: The socket in use.public:
BOOL linger();
Switches the network into 'Linger' mode where all remaining data is sent out before a connection is really closed.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.public:
BOOL sendData(const char * szData, int nSize=-1);
Sends a pile of data into the Network.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.
Name Description szData The data to send to the Network. nSize The size of the data being sent to the Network; if ommitted, the data will be assumed to be a NULL-terminated string and length determined accordingly.
public:
BOOL startServer(unsigned short nPort, unsigned long nIP=0);
Starts the server listening for incoming connections to 1452.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.
Name Description nPort The port that the server should listen on. nIP The IP address to listen on. If ommitted, will listen on all IP addresses.
public:
BOOL terminate();
Closes this Network connection.
Result: Returns TRUE if the operation succeeded, and FALSE if an error occurred.Generated with HeaderDoc - © 2000 Apple Computer, Inc. (Last Updated 9/29/2003)