![]() They've invited me to make a new account but will not pay me the $350 that I earned. They won't tell me which IP or how many instances there were. The only specifics given are that there were multiple software instances on one IP. I have only gotten vague responses as to why I was banned. However, like many of the reviewers, shortly after requesting payout, my account was suspended. As a result I quickly earned $350 and requested a payout at $220. I manage a block of 128 residential IPs with fiber connections and I ran packetstream on each of these IPs. I had a similar experience to many other packeters here. This is not a common pattern in C#.TL DR PS earned nearly 4 grand with my networks and refuse to pay. Your enum member name are all uppercase and separated by underscores. See: MSDN - Disposable pattern Naming Conventions: IDisposable is not as simple as it looks. PacketStream and PacketBase Check your IDisposable implementation If you want PacketStream to be reusable, you could introduce a type parameter for the package key. This is more readable as the cast to int does not confuse during packet registration. ![]() _readerStrategies.Add(PacketType.HEARTBEAT, new object()) _readerStrategies.Add((int)PacketType.HEARTBEAT, new object()) Just a couple of tips: Use enums when possible and cast int to enum not vice versa. If you look at PacketStreamFactoryyou can already see all the packets that the program is able to process. This approach adds a very good first glance at what will happen during code execution. I also thought about creating a plugin based SDK where other developers could simply add other games by registering their PacketStreams read/write methods and implement some kind of generic game interface. The same thing happens in the server application as they both share this library. As soon as the client recieves a succesful login response he converts his LoginServerPacketStream to LobbyPacketStream which enables him to send chatmessages, roomcreation requests and so on.Client application starts and uses the PacketStream returned by CreateLoginServerPacketStream to authenticate.For example during the login state I would only expect my clients to send LoginPackets to my server and not ChatMessagePackets. The idea behind this design is the restriction of packets at times I don't expect them. Is this a reasonable approach or am I cluttering my code with unnecessary patterns? LoginPacket.Password = binaryReader.ReadString() LoginPacket.Username = binaryReader.ReadString() Private static LoginPacket Read(PacketStreamReader binaryReader, LoginPacket loginPacket) Private static void Write(PacketStreamWriter binaryWriter, LoginPacket loginPacket)Ä«inaryWriter.Write(loginPacket.Username) Ä«inaryWriter.Write(loginPacket.Password) PacketStream.Register((int)PacketType.STATUS, Read, Write) PacketStream.Register((int)PacketType.PRESENCE, Read, Write) PacketStream.Register((int)PacketType.ROSTER_ITEM, Read, Write) PacketStream.Register((int)PacketType.ROOM_PRESENCE, Read, Write) PacketStream.Register((int)PacketType.CREATE_ROOM_RESPONSE, Read, Write) PacketStream.Register((int)PacketType.CREATE_ROOM, Read, Write) PacketStream.Register((int)PacketType.CHAT_MESSAGE, Read, Write) Public static PacketStream CreateLobbyPacketStream(IAvailabilityStream stream) ![]() PacketStream.Register((int)PacketType.AUTH_FAILURE, Read, Write) PacketStream.Register((int)PacketType.AUTH_SUCCESS, Read, Write) PacketStream.Register((int)PacketType.LOGIN, Read, Write) PacketStream.Register((int)PacketType.HEARTBEAT, Read, Write) ![]() Var packetStream = new PacketStream(stream) Public static PacketStream CreateLoginServerPacketStream(IAvailabilityStream stream) You create different types of streams by adding read/write strategies inside PacketStreamFactory. PacketStreamFactory manages package registration. _writerStrategies.Add(identifier, (binaryReader, packetBase) => writer(_writer, (T)packetBase)) _readerStrategies.Add(identifier, (binaryReader) => reader(_reader, new T())) If (_readerStrategies.ContainsKey(identifier) || _writerStrategies.ContainsKey(identifier)) Public void Register(int identifier, Func reader, Action writer) where T : PacketBase, new() Public bool Connected was not found in ReaderStrategies.") I'm quite unsure if my implementation of PacketStream and related classes is reasonable or whether I'm overdoing it. NetLib should manage different types of packages through PacketStreams which are based on TcpClients. As part of a small game engine I'm currently working on, I have written a "NetLib".
0 Comments
Leave a Reply. |