Skip to content

Commit

Permalink
Reorganized server files. Added design comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalkushwaha committed Apr 4, 2013
1 parent b1bd274 commit 64245d1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions server/net/NetworkCommunicator.c
@@ -0,0 +1,28 @@
/*
Server will does following
1. Open a socket on the server that listens to the UDP requests. (I’ve chosen 8888)
2. Make a loop that handles the UDP requests and responses
3. Inside the loop, check the received UPD packet to see if it’s valid
4. Still inside the loop, send a response to the IP and Port of the received packet
Client will do following.
1. Open a socket on a random port.
2. Try to broadcast to the default broadcast address (255.255.255.255)
3. Loop over all the computer’s network interfaces and get their broadcast addresses
4. Send the UDP packet inside the loop to the interface’s broadcast address
5. Wait for a reply
6. When we have a reply, check to see if the package is valid
7. When it’s valid, get the package’s sender IP address; this is the server’s IP address
8. CLOSE the socket! We don’t want to leave open random ports on someone else’s computer
NOTE: we don’t close the socket on the server because the server will receive
and send UPD packets until the server is closed. Closing the socket on the server means
that we won’t be able to discover it any more.
*/
21 changes: 20 additions & 1 deletion server/server.c
Expand Up @@ -7,13 +7,32 @@
3. Maintains list of clients in hash with info like IP, protocol supported etc
4. On cli requests, get information about client capablities.
5. can trigger the migration task.
File Organization
=================
*Network Module
- NetworkCommunicator.c
*Client Management
- ClientManager.c
*Parser Server-User interaction
- CommandParser.c
*Utils
- Misc library functions. like khash, logger.
*/

#include <stdio.h>


int main()
{
//
/*
- Intialize the network module.
- Listen for clients in listener thread.
- spawn thread command-parser, which will wait for commands from user.
*/


}
1 change: 1 addition & 0 deletions server/util/utils.txt
@@ -0,0 +1 @@
Readme about utils functions.

0 comments on commit 64245d1

Please sign in to comment.