GTK app send data to TCP server not working

36 views Asked by At

currently i am creating a chat application with interface using GTK library and written in C. But i am having problem sending data to TCP server. I want when I press the button to send data to the server but it doesn't work, below is my code

void on_join_btn_clicked(GtkWidget* btn, gpointer data) {
        send_request("send_msg", "hey!");
}

send_request function:

int send_request(char* command, char* content) {
        Request request;
        unsigned char buffer[sizeof(request)];

        init_request(&request, command, content, &user);
        serialize(request, buffer);

        printf("Hello\n");
        int status = send(user.client_socket, buffer, strlen(buffer), 0); 
        printf("%d", status);

        return status;
}

After clicking on the button, I only see the word "Hello" appear.

0

There are 0 answers