File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,18 @@ bool handle_get_version(int client_fd, char* client_str) {
14
14
return true;
15
15
}
16
16
17
+ void respond_buff_to_client (int fd , char * buff , int buff_len ) {
18
+ int len_htonl = htonl (buff_len );
19
+ int err = send (fd , & len_htonl , sizeof (len_htonl ), 0 );
20
+ if (err < 0 ) {
21
+ perror ("send len in respond_buff_to_client" );
22
+ }
23
+ err = send (fd , buff , buff_len , 0 );
24
+ if (err < 0 ) {
25
+ perror ("send buff in respond_buff_to_client" );
26
+ }
27
+ }
28
+
17
29
void respond_str_to_client (int fd , char * str ) {
18
30
int len_htonl = htonl (strlen (str ));
19
31
@@ -76,7 +88,7 @@ int get_int_from_client(int client_fd) {
76
88
bool get_buffer_from_client (int client_fd , char * output , int output_size ) {
77
89
int client_send_len ;
78
90
int bytes_read = recv (client_fd , & client_send_len , sizeof (client_send_len ), 0 );
79
-
91
+
80
92
if (bytes_read == -1 ) {
81
93
perror ("recv from get_str_from_client in len" );
82
94
}
You can’t perform that action at this time.
0 commit comments