done chatting with socket and single client server……..now implementing multiple client server……
done chatting with socket and single client server……..now implementing multiple client server……
done single client server for sockets…nw implementing threads….
done single client server for socket (inet and unix)……..facing problem in multiple clients…. done 2way chatting using socket and msg queue……now implementing threads…….
struct Node
{
int data;
struct Node *next;
}var;
int main()
{
printf(“SIze of struct = %d\n”, sizeof(struct Node));
return 0;
}
Here it is printing 16.
Can someone explain how it is printing 16?
this is the program for connecting 7nodes……
#include
int main(void)
{
struct node
{
int info;
struct node *d;
};
struct node d1,*n,*t;
{ int i;
d1.d=(struct node*) malloc(sizeof(struct node));
printf(“\nmemory allocation for pointer p of d1\n”);
printf(“\nd1.d=%d\n”,d1.d);
n=(struct node*)malloc(sizeof(struct node));
printf(“\ngiving base address to pointer n\n”);
printf(“\n*n=%d\n”,n);
d1.d=n;
printf(“\n2nd node created.pointer d is having base address of pointer n\n”);
printf(“\nd1.d=%d”,d1.d);
t=n;
printf(“\nlinking 2nd 3rd node t=n\n”);
printf(“\n*t=%d\n”,*t);
for(i=0;id=n;
printf(“\nlinking node %d %d =%d\n”,i+3,i+4,t->d);
t=(struct node*)malloc(sizeof(struct node));
printf(“\n getting anothrer base adderess =%d\n”,*t);
n->d=t;
printf(“\nlinking node %d %d =%d\n”,i+4,i+5,n->d);
} return 0;
————————————————————————————————————————————————
output for linked list……………………….
memory allocation for pointer p of d1
d1.d=149512200
giving base address to pointer n
*n=149512216
2nd node created.pointer d is having base address of pointer n
d1.d=149512216
linking 2nd 3rd node t=n
*t=0
the loop has started from here
n has got the base adderess=0
linking node 3 4 =149512232
getting anothrer base adderess =0
linking node 4 5 =149512248
the loop has started from here
n has got the base adderess=0
linking node 4 5 =149512264
getting anothrer base adderess =0
linking node 5 6 =149512280
………………………………………………………………………………….
sir as i have taken 2 pointers..n equate them in 2/3rd step so that pointers should have same addresses bt after equating them gettin *t=0…..
kindly tell me the areas at which im getting short…..
thank you
Implemented Drivers (Initialization & Registration), Implemented Posix Threads.
1. The address of variables stored in data segment never changes.
2. All the functions are allocated memory in data segments whether it is defined inside main(locally) or outside main(globally).
3. Initialized global variables are stored in data segment, UN-initialized global variables are stored in BSS.
If you know anything new , please let me know.
thanx…..:-)
working on multiple clients and server project based on sockets…!
two way chat completed
working on multiple clients and server project based on sockets…!
sir i have implemented single client server model using socket….heading towards multiple client