Package SocketManager - rsanchez-wsu/jfiles GitHub Wiki
This package is a custom designed network protocol and stack created for the soul purpose of this project. This is an attempt to handle in real time several streams of incoming packets and how to organize and execute them. There is a lot of room for improvement, like being able to make it run a lot more efficiently, handle running checksum on each packet, and how to handle dropped or corrupted packets. Those are to just name a few, this code will need to be approved by the professor and will need to be retooled to be more reusable.
This Software package is implemented into the program to provide the following functionality.
- Create and manage threads
- Create and send packets tracking what is being sent over a network
- Allow for sending and receiving files as packets.
- Checks files and confirms that the packet was sent to over the network without an error.
The package has 4 separate classes
- PacketAssembler
- Packet Priority
- SocketManager
- TrafficTag
Packet Assembler โ This class is used to reassemble the individual packets into a complete file. A new packet assembler is created for every file that is being received. Each packet assembler has an idea tag identical to the file being received. Once the file is completely reassembled it passes the completed file to a waiting and unassigned file var. Once this happ3ns the file with be retrievable. Unless changes to the program or requirements are needed this class should not need any modification.
Packet Priority โ Currently this method takes the packets that are being build and puts a priority level to it from the server. This forces the packet that has the information on what type of command is being sent to be executed first. Eventually this class can be turned into being used when a packet gets corrupted the sever can send a new packet with the information needed at the highest priority.
TrafficTag โ Each packet is tagged in accordance with its type. Command packets are tagged with command tags, files with file tags, etc. Thetc Socketmanager can then sort packets based on their tag.
SocketManager โ This is managing all incoming traffic taking packets and putting them in threads and sorting them so that the data is read sequentially. This also where the sending and receiving of the files is managed. I donโt understand much of it but itโs an in-depth network handler.