Re: [Plib-devel] Networking Code
Brought to you by:
sjbaker
From: Sam S. <sa...@sp...> - 2000-08-22 16:11:55
|
RE: [Plib-devel] Networking Code ----- Original Message -----=20 From: Dave McClurg=20 To: 'pli...@li...'=20 Sent: Tuesday, August 22, 2000 4:08 PM Subject: RE: [Plib-devel] Networking Code Hi Ben,=20 In adding networking code to plib, I recommend keeping it simple like = the code you showed me from tuxkart. We just need a portable way to = setup a connection. The application code should be responsible for the = rest. A turn based game doesn't need dead-reckoning so setPos() probably = doesn't belong in plib proper. Yes, that's certainly the case. I hadn't ever really considered making = the full network library I'm working part of plib - I wanted it to be a = stand alone affair. If it uses portable socket code in plib that's fine = by me though. I'd personally be in favour of this structure for the socket library. TCPSocket *mysock_con =3D new Socket(1234); // Create a = new socket on port 1234 on the server TCPSocket *mysock_client_to_server =3D new Socket('spacething.org', = 1234); // Client attempts to connect to spacething.org on port 1234 TCPSocket *mysock_server_to_client =3D new Socket(mysock_con); // Server = accepts the client connection But that's me. Actually one disadvantage in the above system is that = you can't easily return errors in constructors without using exceptions = - ugh. Best to seperate out the constructor and initialisation code if = you went with the above. Things like real-time state management or match-making systems for = finding opponents could be placed in an auxillary library. |