Go to the source code of this file.
Data Structures | |
struct | NSNetBindHandler |
struct | NSNetConnectionHandler |
struct | NSNetConnectionReadHandler |
Typedefs | |
typedef void(* | NSNetFunc )(void *udata) |
typedef void(* | NSNetReadFunc )(void *udata, const char *bytes, int len) |
typedef void(* | NSNetSuccessFunc )(void *udata, struct NSNetConnectionController *nscc) |
Functions | |
NSNet * | newNSNet (void) |
Initializes networking in a system-independent way. | |
void | waitForNetEvent (struct NSNet *ns, int timeout) |
Waits for a network event to arrive, and dispatches it, or times out. | |
void | closeNSNet (struct NSNet *ns) |
Closes an NSNet interface, freeing the memory and other resources associated with it. | |
int | attemptBind (struct NSNet *ns, const struct NSNetBindHandler *nsb, int isLocalOnly, unsigned short portNum, void *udata) |
Performs an asynchronous bind on a network port and begins listening for connections. | |
int | attemptConnect (struct NSNet *ns, const struct NSNetConnectionHandler *nsc, const char *destaddr, unsigned short destPort, void *udata) |
Creates a new socket and initiates an asychronous connection request to the specified hostname and port. | |
int | attachConnectionReadHandler (struct NSNetConnectionController *nscc, const struct NSNetConnectionReadHandler *nscch, void *udata) |
Attaches a struct NSNetConnectionReadHandler to a live network connetion. | |
int | writeNSBytes (struct NSNetConnectionController *nscc, void *buf, int len) |
Writes a number of bytes to a network connection. | |
int | closeConnection (struct NSNetConnectionController *nscc) |
Closes a network connection. |
Definition in file ns2net.h.
|
|
|
|
|
|
|
Attaches a struct NSNetConnectionReadHandler to a live network connetion.
Definition at line 62 of file ns2net.c. References NSNetConnectionController::fd, NSNetConnectionController::ns, and putInt(). |
|
Performs an asynchronous bind on a network port and begins listening for connections.
Definition at line 78 of file ns2net.c. References NSNet::bindMap, NSNetBindHandler::error, MAXCLIENTS, putInt(), rsockaddr_t, sock_fd, and sock_t. |
|
Creates a new socket and initiates an asychronous connection request to the specified hostname and port.
Definition at line 203 of file ns2net.c. References NSNet::connectMap, putInt(), rassert, rsockaddr_t, setNSnonblocking(), sock_t, and NSNetConnectionHandler::success. |
|
Closes a network connection.
Definition at line 372 of file ns2net.c. References NSNetConnectionController::fd. |
|
Closes an NSNet interface, freeing the memory and other resources associated with it.
Definition at line 364 of file ns2net.c. References NSNet::bindMap, NSNet::connectMap, freeStringTable(), and NSNet::readerMap. |
|
Initializes networking in a system-independent way.
Definition at line 351 of file ns2net.c. References newStringTable(). |
|
Waits for a network event to arrive, and dispatches it, or times out.
Definition at line 273 of file ns2net.c. References NSNet::bindMap, buf, NSNet::connectMap, NSNet::errfds, findInt(), max_fd, NSNet::max_fd, NSNet::readerMap, NSNet::readfds, setNSnonblocking(), sock_t, and NSNet::writefds. |
|
Writes a number of bytes to a network connection.
Definition at line 378 of file ns2net.c. References buf, and NSNetConnectionController::fd. |