Because sockets are a common choice for high-performance communication between cross-platform applications , my question is, does that also make them multilingual?
Bringing the situation to my context, what could be the reason why a server-side algorithm developed in C did not communicate with a client developed in another language?
Is there any specific configuration in the server algorithm so that it is able to recognize only client communication requests developed in the same language?
I developed the C server [in Linux] and the client is a serial redirector [in Windows].
I provide below the server algorithm I am using:
Server.c
-
The code has been tested and works with a client * (. c)
int main(void) { int socket_serv, socket_cli; struct sockaddr_in addr_server; //Cria o socket servidor socket_serv = socket(AF_INET, SOCK_STREAM, 0); setsockopt(socket_serv, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int)); if (socket_serv == -1) { perror ("Nao foi possivel criar o servidor!\n"); return -1; } //Prepara a estrutura do endereco do socket servidor addr_server.sin_family = AF_INET; addr_server.sin_addr.s_addr = inet_addr("192.168.15.15");//INADDR_ANY; addr_server.sin_port = htons(2000); //Bind if (bind (socket_serv, (struct sockaddr *)&addr_server, sizeof(addr_server)) < 0) { perror ("Falhou o bind no servidor\n"); return -2; } //Listen listen (socket_serv, 1); //Aceita uma conexão de um cliente puts ("Aguardando cliente...\n"); while ( (socket_cli = accept (socket_serv, 0, 0)) ) { puts ("Cliente conectado!\n"); .... } return 0;}