jsocket
jsocket copied to clipboard
Add a factory to generate new connections
A factory that could use ServerSockets to instantiate usable instances of a tcp based connection. A config could be provided so that instances are setup already with buffer sizes and services. Cleans up usage.
Adding static methods to Connection would be the simplest option. There would need to be some initializing to do this. TCP uses a ServerSocket while UDP uses DatagramSocket. An enum called ProtocolType could be used to specify which needs initializing and also for which type Connection::getInstance should return. Doing this will slim down the code quite a bit and remove redundancies.