Object-oriented networking

后端 未结 7 1289
臣服心动
臣服心动 2021-02-05 11:07

I\'ve written a number of networking systems and have a good idea of how networking works. However I always end up having a packet receive function which is a giant switch stat

7条回答
  •  隐瞒了意图╮
    2021-02-05 11:52

    You want to keep using the same packet network protocol, but translate that into an Object in programming, right ?

    There are several protocols that allow you to treat data as programming objects, but it seems, you don't want to change the protocol, just the way its treated in your application.

    Does the packets come with something like a "tag" or metadata or any "id" or "data type" that allows you to map to an specific object class ? If it does, you may create an array that stores the id. and the matching class, and generate an object.

提交回复
热议问题