36 |
|
|
37 |
/** |
/** |
38 |
* Destroy a Socket object. Close the socket and release allocated |
* Destroy a Socket object. Close the socket and release allocated |
39 |
* resources. |
* resources. |
40 |
* @param S A Socket object reference |
* @param S A Socket object reference |
41 |
*/ |
*/ |
42 |
void socket_close(Socket_T *S); |
void socket_free(Socket_T *S); |
43 |
|
|
44 |
|
|
45 |
/** |
/** |
46 |
* Write the message 'msg' to the socket |
* Writes a character string. Use this function to send text based |
47 |
|
* messages to a client. |
48 |
* @param s A Socket_T object |
* @param s A Socket_T object |
49 |
* @param msg The message buffer to send |
* @param m A String to send to the client |
|
* @param len The length of the message in bytes |
|
50 |
* @return The bytes sent or -1 if an error occured |
* @return The bytes sent or -1 if an error occured |
51 |
*/ |
*/ |
52 |
int socket_write(Socket_T s, void *msg, int len); |
int socket_print(Socket_T s, const char *m, ...); |
53 |
|
|
54 |
|
|
55 |
/** |
/** |
56 |
* Read a message from the socket. |
* Write size bytes from the buffer b. |
57 |
* @param s A Socket_T object |
* @param s A Socket_T object |
58 |
* @param buf The buffer to write the message to |
* @param b The data to be written |
59 |
* @param len The length of the buffer in bytes |
* @param size The size of the data in b |
60 |
|
* @return The bytes sent or -1 if an error occured |
61 |
|
*/ |
62 |
|
int socket_write(Socket_T s, void *b, int size); |
63 |
|
|
64 |
|
|
65 |
|
/** |
66 |
|
* Reads size bytes and stores them into the byte buffer pointed to by b. |
67 |
|
* @param s A Socket_T object |
68 |
|
* @param b A Byte buffer |
69 |
|
* @param size The size of the buffer b |
70 |
* @return The bytes read or -1 if an error occured |
* @return The bytes read or -1 if an error occured |
71 |
*/ |
*/ |
72 |
int socket_read(Socket_T s, void *buf, int len); |
int socket_read(Socket_T s, void *b, int size); |
73 |
|
|
74 |
|
|
75 |
#endif |
#endif |