Home Forums Support handle received packets

  • This topic has 6 replies, 3 voices, and was last updated 11 years ago by Anonymous.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1327
    Anonymous
    Inactive

    How can I make tcpConn.AppendIncomingPacketHandler works with a client that wasn’t created using this library? My client sends basically byte[] to the server. After receiving the byte[] it must be decrypted (my custom method) and then it should be handled according it’s opcode. The decrypted packet has this structure:

    int size;
    int opcode;
    byte[] data;

    #1333
    Anonymous
    Inactive

    First of all thank you for your interest in NetworkComms.Net. Unfortunately at this stage we only support communication between NetworkComms.Net based clients. This is a much requested feature that we are looking into adding at our next major version.

    One question I have though is why are you using NetworkComms.Net to do a simple byte[] send? If this is between just two machines and there is no complex serialisation it is not that hard to achieve just using a basic TcpClient instance. I only ask to better understand the use case for this as normally NetworkComms.Net comes into it’s own when trying to either manage many persistent connections or when sending a custom object that requires complex serialization/compression.

    Regards,

    Matt

    #1335
    Anonymous
    Inactive

    I would like to use NetworkComms.Net because I didn’t want to create all the TcpClient code, but use one already created, like your library. It would save me a lot of time coding network basics and I would have more time to focus in my program core.

    Any chance that one day you might add this feature? It is one server and multiple clients. If yes, do you have any date available of when you’ll release it? Just so I can organize myself.

    #1337
    Anonymous
    Inactive

    Why not use NetworkComms.Net for all clients. Why do you need a feature that interfaces with other libraries?

    #1338
    Anonymous
    Inactive

    Because I am developing an online game emulator, and I don’t have the client source-code, so I can’t modify how client networking works.

    #1339
    Anonymous
    Inactive

    Many thanks for the quick response.

    We don’t have a date yet for supporting other libraries as everyone potentially implements their own network structure making it, possibly impossible, for us to support a general case.

    If you could tell us which online game emulator you are using it would be useful to investigate how they have approached their networking support.

    Kind regards,
    Marc

    #1341
    Anonymous
    Inactive

    I am creating an emulator for a game called Priston Tale. It works like every other winsock application. It just sends byte[] to the server, which I parse according the opcode and then I answer with another byte[]. Not much complicated.

    This is how I did to receive the packets, using TcpClient:

    `/// <summary>
    /// Waits until a packet is received from client
    /// </summary>
    void Run(object stateInfo)
    {
    var data = new byte[0x1000];
    byte[] packet;
    var read = 0;

    while (true)
    {
    try { read = stream.Read(data, 0, 0x1000); }
    catch (Exception)
    {
    Clients.pInfo.Remove(this.key);
    break;
    }

    if (read == 0)
    {
    Clients.pInfo.Remove(this.key);
    break;
    }

    packet = new byte[read];
    Array.ConstrainedCopy(data, 0, packet, 0, read);
    packets.Queue(packet, this);
    }
    client.Close();
    }`

    the stream variable is obtained using tcpclient.GetStream() method.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.