27,19 → 27,16 |
/* checks whether or not a socket is connected. returns: |
* 0 = not connected, |
* 1 = connected |
* -1 = error |
* |
* if waitstate is non-zero, then net_isconnected() may release a few cpu |
* cycles (useful when net_isconnected() is used within a busy loop). */ |
int net_isconnected(struct net_tcpsocket *s, int waitstate); |
* -1 = error */ |
int net_isconnected(struct net_tcpsocket *s); |
|
/* Sends data on socket 'socket'. |
Returns the number of bytes sent on success, and <0 otherwise. The error code can be translated into a human error message via libtcp_strerr(). */ |
int net_send(struct net_tcpsocket *socket, const char *line, long len); |
int net_send(struct net_tcpsocket *socket, const void *line, long len); |
|
/* Reads data from socket 'sock' and write it into buffer 'buff', until end of connection. Will fall into error if the amount of data is bigger than 'maxlen' bytes. |
Returns the amount of data read (in bytes) on success, or a negative value otherwise. The error code can be translated into a human error message via libtcp_strerr(). */ |
int net_recv(struct net_tcpsocket *socket, char *buff, long maxlen); |
int net_recv(struct net_tcpsocket *socket, void *buff, long maxlen); |
|
/* Close the 'sock' socket. */ |
void net_close(struct net_tcpsocket *socket); |