Thanks :-) If you find any bugs (or if it works), please let me know.
I'd still suggest looking into TNL, RakNet and the rest, though, as this library is very thin, and doesn't purport to solve matchmaking nor state replication.
Light-weight Network Messaging Library
I like the error reporting now. It allows me to have both a Debug that can OutputToDebugString what I need as I debug the app, but the Retail version can stick it to the NULL notification interface and run at full speed.
One thing that didn't strike me earlier is the ISocketManager interface. In some way, this is what Steve MacGuire would call a "candy-machine" interface. Depending on the mode you put it in, only a subset of the API is actually useful. I don't think it's a big deal; the whole socket API is a big candy-machine interface anyway... But repackaging the interface as IClientSocketManager and IServerSocketManager with the proper API subset could alleviate the potential confusion for novices.
-cb
One thing that didn't strike me earlier is the ISocketManager interface. In some way, this is what Steve MacGuire would call a "candy-machine" interface. Depending on the mode you put it in, only a subset of the API is actually useful. I don't think it's a big deal; the whole socket API is a big candy-machine interface anyway... But repackaging the interface as IClientSocketManager and IServerSocketManager with the proper API subset could alleviate the potential confusion for novices.
-cb
That's an interesting observation; I had considered splitting accepting out to another interface, but let it stay in a single interface to make it more approachable.
It is quite conceivable that you can call connect() on an "accepting" ISocketManager, and receive a socket that lets you talk to another machine. The only function that you "won't" call if you're not accepting is "accept()" -- although it's perfectly legal to call it; you'll just get no sockets back.
I suppose what you're suggesting is that you create the basic interface first, and then you create an "accepting" interface off of the basic interface, if you want to accept incoming connections.
There's also something to be said for keeping the interface close to the internal structure. When the interface is created for UDP communication, there will always be an open socket, which will be used for accepting if accepting is true. The management of this socket, vs the unknown timing of when the user may create the accepting interface, leads me to believe that the current design is simpler.
It's a valid observation, though; thanks!
It is quite conceivable that you can call connect() on an "accepting" ISocketManager, and receive a socket that lets you talk to another machine. The only function that you "won't" call if you're not accepting is "accept()" -- although it's perfectly legal to call it; you'll just get no sockets back.
I suppose what you're suggesting is that you create the basic interface first, and then you create an "accepting" interface off of the basic interface, if you want to accept incoming connections.
There's also something to be said for keeping the interface close to the internal structure. When the interface is created for UDP communication, there will always be an open socket, which will be used for accepting if accepting is true. The management of this socket, vs the unknown timing of when the user may create the accepting interface, leads me to believe that the current design is simpler.
It's a valid observation, though; thanks!
Umm, I got a problem with your library.
When I try to compile your example it doesn't find do_something_with_active_socket.
I suppose that there is no function that does something with the active socket, but I wonder, what to do? :S
I'm a total newbie to networking, and I don't know very much about sockets and connections and stuff. :P
When I try to compile your example it doesn't find do_something_with_active_socket.
I suppose that there is no function that does something with the active socket, but I wonder, what to do? :S
I'm a total newbie to networking, and I don't know very much about sockets and connections and stuff. :P
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement