|
|
|
Date Posted: 2005-02-09 18:34 |
|
What should actually happen is this:
1. Client creates listener thread
1.A. Listener thread opens socket on clientPort and calls recvfrom in a loop
1.B. When packet received, save/display contents
2. Client enters user input loop
2.A. User selects option
2.B. Client opens a socket on routerPort (same IP)
2.C. Client sends packet
2.D. Client closes socket (routerPort)
2.E. Repeat if !exit
3. Router opens a socket on routerPort and calls recvfrom in a loop
3.A. When packet received, spawn a new thread to handle it and listen for next packet on routerPort (same socket)
3.B. If sending to a router (different machine), open a new socket to next IP on routerPort, sendto, and close socket
3.C. If sending to a client (same machine), open a new socket at the same IP on clientPort, sendto, and close socket
What that boils down to is this: clientPort and routerPort are the ports that the client and router (respectively) listen on. The ports used to send are unknown (we don't care what they are).
|
|
|