Larios
Larios
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
Thanks again, i'll close the post now
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
I've implemented basic serialization and deserialization and my code is already looking much better and is much easier to maintain
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
ty
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
I think i'll go with the identifier for now as it seems easier to me since I don't have much experience in serialization and double serialization would complicate stuff a bit too much
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
I'm gonna do some tests and see what method works best/is easier to implement
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
alright thank you very much for your help you cleared up a lot of stuff for me
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
let's say for the sake of simplicity i only use this for RemoteClient, I would need to do a double serialization? I would have to serialize Message, but Message contains RemoteClient which has to be serialized aswell?
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
so I send a serialized Message object which has string orderString and RemoteClient remoteClient. Client deserializes Message, understands what to do from orderString and deserializes remoteClient?
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
I mean if i create a packet whic has a string, then at the end of the string the RemoteClient object, how does the receiving end know where the string ends and where the RemoteClient data starts
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
how could that be done?
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
1) server sends UDP packet to client with string "alive?" 2) client receives UDP packet, reads the received string "alive?" and decides which method to use. Decides to use method which sends "yes" to server 3) server receives UDP packet, reads the received string "yes" and decides which method to use. Decides to use method which calculates latency and ticksToAdd 4) server creates RemoteClient remoteClient object, with int latency and int ticksToadd. Populates the fields with values calculated in step 3, serializes RemoteClient remoteClient and sends it to client. 5) client receives UDP packet. There is no string in the packet only a RemoteClient serialized object. How can the client know that it has to deserialize it? There is no string that tells the client what to do
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
Like
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
I think i understand what serialization can be used for but I'm having troubles implementing it
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
Sorry if i may not be explaining myself properly but I'm learning along the way with this project so I may be missing crucial informations
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
Sometimes I need to send different data types, for example an int mixed together with a string. Like: //Server sendbuf = Encoding.ASCII.GetBytes($"Your Latency is:{answeringClient.latency},Add this amount of ticks:{ticksToAdd}"); //Client string receivedString = Encoding.ASCII.GetString(receivedBytes, 0, receivedBytes.Length); string[] splitString = receivedString.Split(","); string latency = splitString[0].Substring(splitString[0].LastIndexOf(":") + 1); string ticksToAdd = splitString[1].Substring(splitString[1].LastIndexOf(":") + 1); logHandler.ConsoleLog($"Received latency = {latency} Ticks to add = {ticksToAdd}"); Eventually i'd love to pass more complex information, for example if I create an object server-side and I want the client to create it too
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
thanks for the answer btw
39 replies
CC#
Created by Larios on 7/21/2023 in #help
❔ Are strings the best way for Server-Client UDP communication?
I did read a bit about serialization but I'm probably not understanding it. Assuming I use xml serialization, Applying it to the example above, am I not just adding an extra step? I'd serialize the string before sending it, deserialize it while receiving, but I'd still have to compare the string in an if or switch statement to apply logic to it
39 replies