Line 16... |
Line 16... |
16 |
/* must be called before using libtcp. returns 0 on success, or non-zero if network subsystem is not available. */
|
16 |
/* must be called before using libtcp. returns 0 on success, or non-zero if network subsystem is not available. */
|
17 |
int net_init(void);
|
17 |
int net_init(void);
|
18 |
|
18 |
|
19 |
/* initiates a connection to an IP host and returns a socket pointer (or NULL
|
19 |
/* initiates a connection to an IP host and returns a socket pointer (or NULL
|
20 |
* on error) - note that connection is NOT established at this point!
|
20 |
* on error) - note that connection is NOT established at this point!
|
21 |
* use net_isconnected() to know when the connection is connected. */
|
21 |
* use net_isconnected() to know when the connection is connected.
|
- |
|
22 |
* buffsz is the size of the TCP buffer that will be allocated by net_connect. */
|
22 |
struct net_tcpsocket *net_connect(const char *ip, unsigned short port);
|
23 |
struct net_tcpsocket *net_connect(const char *ip, unsigned short port, unsigned short buffsz);
|
23 |
|
24 |
|
24 |
/* checks whether or not a socket is connected. returns:
|
25 |
/* checks whether or not a socket is connected. returns:
|
25 |
* 0 = not connected,
|
26 |
* 0 = not connected,
|
26 |
* 1 = connected
|
27 |
* 1 = connected
|
27 |
* -1 = error */
|
28 |
* -1 = error */
|