Client/Server...2 small questions...
Posted on 2005-05-05
i have developed a simple concurrent server in C.
2 small questions
1)Firstly i would like to show how many concurent connections there are connected to the server.
Adding to the count is no problem( simply increment after the accept). The problem comes when i try to decrement the count...The thing is that i must pass a msg from the child process to the parent which is usuailly done with a Signal. I cant figure them out. Can someone tell me what to do?
2) and lets say that within the server i have this....
struct sockaddr_in caller;
if ((csd = accept(ssd, (struct sockaddr *)&caller, &length)) < 0)
How do I show the client's IP address on the server screen? I have looked up the sockaddr and sockaddr_in structures but i still cant get it!!...I know i must do something like....
printf("Client's IP Address is: %s", caller->...);
What is the exact syntax??