Hi,
thanks for your reply. the problem is not about the compiling ...
Actually I don't get any warning or error when the programs are compiled, but the problem is when the sub-prog2 is exucuted and then I get the errors like: segmentation ...
My question is how to handle multipe sending and receiving data using udp socket ???? Any one has an idea, it would be appreciated. Thanks
Regards and thanks for...
User Profile
Collapse
-
how to handle multiple send and receive with udp socket
Dear All,
Could someone help and tell me how to handle multiple send and receive operations with udp sockets? In fact here is my problem:
server.c is composing of serveral sub programs (the same for client.c)
-----server.c-------
[code=c]
............... .
int main(){
............
//create socket
if (sd = socket(PF_INET, SOCK_DGRAM, ptrp->p_proto)) {
fprintf(stderr,... -
Hi,
Thanks for your replies. I tried also to use macros: htonl and ntohl as the variables exchanged between client and server are defined in double. But it does not work ... and here is a peace of code I wrote:
-------- client.cpp---
...
typedef struct SIM_DATA_IN{
// char svar_instg;
double svar_integ[2];
double svar_indl[5];
};
SIM_DATA_IN stus;
...
stus.svar_integ[0]=htonl(var);...Leave a comment:
-
-------------
Hi Jos,
I tried also to use macros: htonl and ntohl as the variables exchanged between client and server are defined in double. But it does not work ... and here is a peace of code I wrote:
-------- client.cpp---
...
typedef struct SIM_DATA_IN{
// char svar_instg;
double svar_integ[2];
double svar_indl[5];
};
SIM_DATA_IN stus;
...Leave a comment:
-
-------------
Hi Jos,
I tried also to use macros: htonl and ntohl as the variables exchanged between client and server are defined in double. But it does not work ... and here is a peace of code I wrote:
-------- client.cpp---
...
typedef struct SIM_DATA_IN{
// char svar_instg;
double svar_integ[2];
double svar_indl[5];
};
SIM_DATA_IN stus;
...Leave a comment:
-
Hi all,
Thanks a lot for your replies, that is very kind of you ...
This is just to answer you (I mean the second replyer) about using macro or not. If I know how to use it I wouldn't come here and post a message for a help ... ok!
I want to use it because I need it for my work and if you know any other easiest way just tell it and your help would be appreciated ...
Sorry! I am not the person who knows everything...Leave a comment:
-
-----------------------
Hi Jos,
Thanks a lot for your reply. You are right that is what I read on the internet but I couldn't find details on how to write and it is the first time that I am dealing with. I would be glad if you could explain more about or send me the usefull link.
Regards and thanks for your reply,
Azwaw...Leave a comment:
-
byte reordering macro (big/litte endian conversion between OS)
Dear all,
Could someone please clarify and help with byte ordering macro (big/litte endian conversion)? I found thefollowinf macron on the internet but I have a doubt to use it ...
============
#if defined(BIG_END IAN) && !defined(LITTLE _ENDIAN)
#define htons(A) (A)
#define htonl(A) (A)
#define ntohs(A) (A)
#define ntohl(A) (A)
#elif defined(LITTLE_ ENDIAN) &&... -
byte ordering macro (big/litte endian conversion between os)
Dear all,
Could someone please clarify and help with byte ordering macro (big/litte endian conversion)? I found thefollowinf macron on the internet but I have a doubt to use it ...
============
#if defined(BIG_END IAN) && !defined(LITTLE _ENDIAN)
#define htons(A) (A)
#define htonl(A) (A)
#define ntohs(A) (A)
#define ntohl(A) (A)
#elif defined(LITTLE_ ENDIAN) &&...
No activity results to display
Show More
Leave a comment: