Hi, from what I can see the socket is not doing anything or you did not post the full code. The server socket never calls listen or accept. Maybe you could provide us more information? In a nutshell there a three possible designs for a server: your server handles one client at a time (example), uses asynchronous I/O (multiple connections in a single thread context) or uses multi threading (one connection per thread).
Could you please format your code with <pre> tag for readability and remove the French comments? It was quite hard to read.
Looking again at your code, you have a blocking UDP socket waiting for a connection, which calls ExecuteCommand() and exists the thread? Perhaps all you are looking for is a for loop (and a way to programatically exit the worker thread)?
Right now the worker thread has no exit condition, you probably want to add one in order to avoid terminating the thread the hard way at application exit. Also have a look at some other issues, e.g. starting from this line
int nb_caracters = recvfrom(socket_recevoir, buffer, sizeof(buffer)-1, 0, (struct sockaddr*)&information_recevoir, &tempo);
if(nb_caracters > 0) //data was received and no socket error (return value -1)?
buffer[nb_caracters] = 0; //one byte was reserved for terminating Null
ExecuteCommand(buffer, NULL, 0); //lets hope it was a complete package and also not a duplicate
no, no, no .... That's not the way to go!
You put some code with some syntax error and even some misconception in it.
That reveal that you are not understanding what your code has to do.
The compiler just gives some errors, but those errors are random as your code is. Attempting to fix those errors doesn't lead anywhere: you're never granted your code will do what you expect.
printf("Enter a string : ");
s is a pointer pointing to nowhere: where do ypu thoing your scanf can write to ?!? s[l]=0; tries to write to nowhere since s isnowhere a is a pointer to int, but you do a=(char*)malloc(l): what did you want to do? allocating char-s or int-s ?!
This is a mess of tokens with no syntax meaning! Raed about the for syntax, and understand the proper use of '()', ',', and ';'.
x=l-1 Wow... you're looking for problems: never use names like "O" and "l": I have to change font before find it's "l-1" and not "l-l" ... Do you get what I mean? If not, than that demonstrate the problem
Then: I see a malloc, but i don't see a free: not a good way to program...
I don't continue, but what can you do if you don't have clear in your mind what you're gonna do?
Thanks for vital information and suggestion.
I want to generate Combination of given String.Like this CString test="ABC", then generate like this
If you have any type solution or suggestion then please help me.
Ok, that's the problem. Now try to come to an algorithmic solution.
That doesn't need to be C or C++, just pseudocode.
Only when you find your algorithm looks meaningful, try to code it!
Than: the problem is not well formed. Do you want only two char-s combination? Does the input string needs to be 3 char-s wide or can it be whatever?
Be sure about that: you risk to produce a code that works on a very specific case, while looking for something more generic.