As mentioned in my last thread, im working on developing a program using sockets. I have a quick question which is more class related than anything.
I'm coding my own sockets library class, and as such is currently implemented such as:
The socket is handled entirely internally and every function related to the socket is used via the class object e.g sock.connect, sock.recvdata, sock.senddata etc.Code:MySocket sock; sock.connect(ip, port); sock.setnonblock(); ....
My question is, in terms of usability/future projects should I keep the coding as above, a class as a "mini-program" as i call them (related question further below), or should i force each function to require the socket to work on? so then the user can create a socket file descriptor and then use MySocket::Connect(sockfd, ip, port) ?
Related: If my current implementation is viable for future projects, anything really, should I pass the socket object to other subsystems upon starting it and store it in the subsystems class? (quick example of this would be appreciated thanks, not entirely sure how to implement it).