Interesting stuff. Had been considering writing a non splitter based source but never found a reason to come back to CoDev really .
Side note/question for those 'in the know'.
Most coding styles I've been taught recently dictate 1 entry point and 1 exit point for any function (multiple return statements are a big no no). Is this just my course and the coding standards they use or is it fairly universal?
Most coding styles I've been taught recently dictate 1 entry point and 1 exit point for any function (multiple return statements are a big no no). Is this just my course and the coding standards they use or is it fairly universal?
We're taught the same thing at my school. We're told to always declare a "result" variable and return that at the end of a function. I guess it makes code easier to read and understand.
Most coding styles I've been taught recently dictate 1 entry point and 1 exit point for any function (multiple return statements are a big no no). Is this just my course and the coding standards they use or is it fairly universal?
Seems to be universal, I am being taught the same way at my University, one single return/exit for a function
[...]Most coding styles I've been taught recently dictate 1 entry point and 1 exit point for any function (multiple return statements are a big no no). Is this just my course and the coding standards they use or is it fairly universal?
That's the schools coding standards and the companies coding standards, mostly. It is just a good practice as it is easier to debug. Plus, when dealing with memory, you don't need to delete all your pointer at each exit points... But, it is okay at the start of the functions... When you haven't done much, and it is mostly checks.
This is an unnecessarily complex and badly thought out way of doing it, a nice try though. Not to mention that this just simply wouldn't work with CO in its current state.
Edit: And thinking about it, this wont work reliably with any real-life application for the same reason lol..
Edit 2: And just so your aware its the same problem that Inf highlighted in the last thread you made on this subject, you still haven't addressed it >_>
This is an unnecessarily complex and badly thought out way of doing it, a nice try though. Not to mention that this just simply wouldn't work with CO in its current state.
Edit: And thinking about it, this wont work reliably with any real-life application for the same reason lol..
Edit 2: And just so your aware its the same problem that Inf highlighted in the last thread you made on this subject, you still haven't addressed it >_>
I've never had issues with it o_o Not at all.
it receives size and begins to receive that size and doesn't handle the packet before the actual size is there then it proceed to receive the next packet o.o
Wait, I think I get it...
So if I understand correct I'd just call receive again with the remaining bytes? (If there is any.)
Packet fragmentation is fairly common, the fact you haven't had any problems is a miracle, not the rule of thumb.
Problem is you might get a packet header that indicates you need to receive 32 bytes, then when you receive the available data from the socket you only get 12 bytes, you immediately disconnect the client and assume that the client died at the other end or unplugged the cable or whatever. Chances are that, due to the way TCP works, the packet has been split, or has become fragmented during its journey, so you need to receive the rest of the data for that packet before handling it.
How you go about doing it is your business really, there's a number of different ways, some more complicated than others.
[Release]Async Sockets (No packet-splitter) 09/20/2012 - CO2 Programming - 16 Replies So after seeing this thread: http://www.elitepvpers.com/forum/co2-pserver-discu ssions-questions/2129268-problem-packet-splitting. html
I thought I'd make some socket server that could handle the packets without needing to split.
Source:
BasicClient.cs
using System;
problem at packet splitting 09/19/2012 - CO2 Private Server - 16 Replies im having problem with getting wrong packets and everyone told me it's because wrong packets splitting but it doesn't make sense for me because
Packet Nr 8319. Server -> Client, Length : 92, PacketType: 1008
54 00 F0 03 46 BB 77 02 F3 4A 02 00 BB 11 F7 11 ;T ðF»wóJ »÷
03 00 06 00 00 00 00 00 0D 0D 00 00 00 00 00 00 ;
00 05 00 00 00 00 00 00 00 00 00 00 00 00 01 00 ;
09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;
00 00...
about splitting 01/12/2006 - Conquer Online 2 - 2 Replies hey all i got a little trouble while making split,
coz when i check on I WISH TO MOVE, ACC, PASS AND VALIDATIONPASS, then SUBMIT, i got this msg: WAHT ARE YOU DOING?, what is about? in my other acc i was corect to split, plz help :rolleyes: