Solved: If I use pthread_self() instead of getppid() the programs works fine.
Type: Posts; User: jstechg
Solved: If I use pthread_self() instead of getppid() the programs works fine.
I am developing a simple program in C on linux in which there is a thread that checks the time elapsed since the beginning of the program and when they have passed 10 seconds, sends an end signal...
I solved this issue by myself.
Is necessary to add on MapExample.cpp the lines:
std::map <int,int> MapExample::map3;
std::map <int,SData> MapExample::map4;
I am testing in linux the use of map in a C ++ class called MapExample.
If only map1 and map2 appear in this class, it compiles and works correctly, showing on the screen the exit:
Hello...
Thanks, I am going to try this. But I want to have a multithread server. So, I think that defining the thread function as static is not a good idea.
Colud be that I define it as friend instead?
serverTCP.c: (C version. It works fine)
------------
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
...
client.c : (It works fine)
----------
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
The TCP server that I am developing as a C ++ class is based on a C client-server application that works perfectly.
The C ++ class of the server is intended to be a replica of the server written...
I have developed a server in C ++ and a client that connects to it.
Both are running on a PC with linux.
When we run the server and a client is connected to it, a
Segmentation fault on the...