| 16 |
***************************************************************************/ |
***************************************************************************/ |
| 17 |
|
|
| 18 |
#include "common.h" |
#include "common.h" |
| 19 |
|
#include <string.h> |
| 20 |
|
#include <sys/socket.h> |
| 21 |
|
|
| 22 |
char |
char |
| 23 |
s_getc(int socket) |
s_getc(int socket) |
| 30 |
} |
} |
| 31 |
|
|
| 32 |
int |
int |
| 33 |
|
s_putc(int socket, char c) |
| 34 |
|
{ |
| 35 |
|
int ret; |
| 36 |
|
|
| 37 |
|
ret = send (socket, &c, 1, 0); |
| 38 |
|
|
| 39 |
|
return ret; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
int |
| 43 |
s_receive(int socket, char* buffer, int buffer_length, char end_str[]) |
s_receive(int socket, char* buffer, int buffer_length, char end_str[]) |
| 44 |
{ |
{ |
| 45 |
char buf_str[2048]; |
char buf_str[2048]; |
| 77 |
int |
int |
| 78 |
s_send(int socket, const char* in_str) |
s_send(int socket, const char* in_str) |
| 79 |
{ |
{ |
| 80 |
|
int ret; |
| 81 |
|
|
| 82 |
if (in_str != NULL && strlen(in_str) > 0) |
if (in_str != NULL && strlen(in_str) > 0) |
| 83 |
{ |
{ |
| 84 |
send(socket, in_str, strlen(in_str), 0); |
ret = send(socket, in_str, strlen(in_str), 0); |
| 85 |
} |
} |
| 86 |
|
|
| 87 |
|
return ret; |
| 88 |
} |
} |