Difference between revisions of "Nsysnet.rpl"
Jump to navigation
Jump to search
Marionumber1 (talk | contribs) (→Networking: Standard BSD names also work) |
(Added description for some functions) |
||
Line 37: | Line 37: | ||
|Listens for connections | |Listens for connections | ||
|SO_* | |SO_* | ||
− | |||
|- | |- | ||
|SORecv | |SORecv | ||
|<code>int SORecv(int fd, void *buffer, int len, int flags);</code> | |<code>int SORecv(int fd, void *buffer, int len, int flags);</code> | ||
− | | | + | |Receive data from a remote socket |
|SO_* | |SO_* | ||
|- | |- | ||
|SORecvFrom | |SORecvFrom | ||
|<code>int SORecvFrom(int fd, void *buffer, int len, int flags, struct sockaddr *from, int *fromlen);</code> | |<code>int SORecvFrom(int fd, void *buffer, int len, int flags, struct sockaddr *from, int *fromlen);</code> | ||
− | | | + | |Same as SORecv but with target specified |
|SO_* | |SO_* | ||
|- | |- | ||
|SOSend | |SOSend | ||
|<code>int SOSend(int fd, const void *buffer, int len, int flags);</code> | |<code>int SOSend(int fd, const void *buffer, int len, int flags);</code> | ||
− | | | + | |Send data to remote socket |
|SO_* | |SO_* | ||
|- | |- | ||
|SOSendTo | |SOSendTo | ||
|<code>int SOSendTo(int fd, const void *buffer, int len, int flags, const struct sockaddr *dest_addr, int dest_len);</code> | |<code>int SOSendTo(int fd, const void *buffer, int len, int flags, const struct sockaddr *dest_addr, int dest_len);</code> | ||
− | | | + | |Same as SOSend but with target specified |
|SO_* | |SO_* | ||
|} | |} |
Revision as of 17:26, 5 April 2015
nsysnet.rpl is the library that provides BSD socket related functions.
Functions
Base
Name | Prototype | Description | Returns |
---|---|---|---|
SOInit | int SOInit(void);
|
Initializes the library. | SO_* |
SOFinish | int SOFinish(void);
|
Cleans up after the library. | SO_* |
Networking
These are also available under their standard BSD names (connect(), recv(), send(), etc.), without the SO_* prefix.
Name | Prototype | Description | Returns |
---|---|---|---|
SOConnect | int SOConnect(int fd, struct sockaddr *addr, int addrlen);
|
Connects to the defined target | SO_* |
SOListen | int SOListen(int fd, int backlog);
|
Listens for connections | SO_* |
SORecv | int SORecv(int fd, void *buffer, int len, int flags);
|
Receive data from a remote socket | SO_* |
SORecvFrom | int SORecvFrom(int fd, void *buffer, int len, int flags, struct sockaddr *from, int *fromlen);
|
Same as SORecv but with target specified | SO_* |
SOSend | int SOSend(int fd, const void *buffer, int len, int flags);
|
Send data to remote socket | SO_* |
SOSendTo | int SOSendTo(int fd, const void *buffer, int len, int flags, const struct sockaddr *dest_addr, int dest_len);
|
Same as SOSend but with target specified | SO_* |
Error
Name | Prototype | Description | Returns |
---|---|---|---|
SOInit | int SOLastError(void);
|
Recives the latest error??? | The latest error(SO_*)??? |
Error Codes
The error codes that SO functions can return. if the error code starts with "SO_E" so were the operation not successful otherwise it were.
Name | Value | Description |
---|---|---|
SO_SUCCESS | 0 | The operation were successful |
SO_ETIMEDOUT | 2 | The connection timed out |
SO_ECONNREFUSED | 7 | The connection were refused |
SO_ERROR | 41 | The operation hit a generic error and were not successful |
SO_ELIBNOTREADY | 43 | The library is not ready, did you forget to initialize it? |
Structures
Name | Data |
---|---|
sockaddr_in |
typedef struct {
u16 sin_family;
u16 sin_port;
struct in_addr sin_addr;
char sin_zero[8];
} sockaddr_in; |